下载完之后打开eclipse导入外部maven项目;
![这里写图片描述](https://img-blog.csdn.net/20170301163835218?watermark/2/text/a 《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》无偿开源 威信搜索公众号【编程进阶路】 HR0cDovL2Jsb2cuY3Nkbi5uZXQvenRfZnVja2Vy/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
然后再pom里面引入web模块
org.springframework.boot
spring-boot-starter-web
项目遵循mvc结构mapper、service、controller
首先是视图controller
新建HelloWorldController.java如下:
package com.demo.controller;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@EnableAutoConfiguration
public class HelloWorldController {
@RequestMapping(“/hello”)
@ResponseBody
String home() {
return “Hello World!”;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(HelloWorldController.class, args);
}
}
run application
最后打开浏览器输入网址:[http://localhost:8080/hello](()