Spring Boot来简化Spring应用开发,约定大于配置, 去繁从简。
创建SpringBoot项目 添加依赖
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-web
写一个最简单的控制器
package com.lglbc.springbootlearning;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class IndexController {
@RequestMapping("/test")
public String hello(){
return "helloWorld";
}
}
运行项目
测试一波
http://localhost:8080/test



