1.首先安裝springboot快速搭建插件
打開-HELP->Eclipse Marketplace->搜索spring,安裝此插件,重啓eclipse
然後新建springboot項目即可
這樣我們就快速搭建了一個簡單版的springboot項目出來。然後我們先運行看看。
package yick.demo.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
@SpringBootApplication
@RestController
public class SpringbootDemo1Application {
public static void main(String[] args) {
SpringApplication.run(SpringbootDemo1Application.class, args);
}
@GetMapping(value = "hello")
public String hello() {
return "Hello,Spring boot";
}
}
訪問http://localhost:8080/hello,如圖
大功告成,是不是非常簡單呢。