基于IntelliJ IDEA 的spring_boot项目搭建
IntelliJ IDEA对开发比较友好,对新技术也第一时间支持,所以我用IntelliJ IDEA开始学习spring_boot框架。
1,新建Spring Initializr项目

2,填写项目信息

3,选择你要使用的技术,这里选的是web项目

4,填写项目名称,点击finish完成

接下来编写第一个程序hello world,直接在主函数里面写就行了

package spring_boot.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@RequestMapping("/")
String index(){
return "hello world";
}
}
运行工程,在浏览器中输入:localhost:8080, 就可以看到Hello World了。