IDEA构建 Spring Boot 入门:HelloWorld

  • 新建项目
    1.
    这里写图片描述
    2.这里写图片描述
    3.
    这里写图片描述

    • 项目构建完成,等待maven下载依赖,下载完毕,目录结构如下

这里写图片描述

  • 书写hello world代码

这里写图片描述

代码如下:


@RestController
@EnableAutoConfiguration

public class HelloWordController {

    @RequestMapping("/hello")
    private String index(){

        return "hello world";
    }



}
  • 运行DemoApplication文件,访问localhost:8080/hello

这里写图片描述

这样一个Spring Boot的小demo就完成了

猜你喜欢

转载自blog.csdn.net/weixin_39216383/article/details/80917272
今日推荐