springboot与传统方法工程的基本步骤

传统方法

a: 创建web工程

b: 配置springmvc web.xml

c: 编写controller

d :部署tomact

springboot

1 创建springboot 工程 必须继承spring-boot-stater-parent

 

 

 

 

2 编写controller

@RestController //相当于Controller ResponseBody
@RequestMapping("/user")
public class UserController {

    @GetMapping("/json")
    public String getJson(){
        return "Hello World!";
    }
}

3 主启动类

//主启动类
@SpringBootApplication public class SpringbootMybatisApplication { public static void main(String[] args) { SpringApplication.run(SpringbootMybatisApplication.class, args); } }

4 启动main

原文地址:https://www.cnblogs.com/cmxblog/p/11808430.html