SpringBoot默认是Maven项目
1、File->New Project->SpringInitializr->Next
2、填写信息,跟Maven一样
3、选择需要的功能,SpringBoot已经封装好,只需要选择需要的模块功能就行,这里选择了基本的Web模块,选择后在pom.xml文件会有不同的导入
4、项目结构
4、在SpringbootWebApplication.java下建立类TestController
package com.xue.springbootweb.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description
* @Author xuexue
* @Date 2019/9/28 17:25
*/
@RestController
public class TestController {
@RequestMapping(value = "/hello")
public String toHelloWorld() {
return "Hello World!";
}
}
5、启动SpringbootWebApplication
6、测试