SpringBoot入门,新建SpringBoot项目

一、在Spring Initializr中创建初始化项目

  https://start.spring.io/

  

二、通过maven导入Idea中(解压后的项目)

  解压文件

  

  黄色的为项目需要的真正的代码 , 蓝色git , 红色是maven其中有第三方插件可以改为Gradle. 只留黄色的就可。

  

  选择Import project from external model 一直next到finsh.

三、写个小rest例子

@RestController
public class HelloController {
    //@GetMapping("/hello")
    @RequestMapping(value = "/hello" , method = RequestMethod.GET)
    public String hello(){
        return "Hollo World";
    }
}

  

  运行项目访问 http://localhost:8080/hello

  

   

 

posted @ 2019-05-27 10:11  TimeSay  阅读(196)  评论(0编辑  收藏  举报