IDEA支持使用Spring的项目创建一个Spring Boot项目
(向导会联网创建Spring Boot项目
测试:
1.编写controller:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
//这个类的所有方法返回的数据直接写给浏览器(如果是对象转为json数据
//@RestController是@ResponseBody和@Controller的组合注解
/*@ResponseBody
@Controller*/
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "hello world quick";
}
}
2.运行主程序测试:
3.访问:
over~