注意第一个Helloworld项目:浏览发送/hello请求,响应hello,SpringBoot 2
原始SSM:MVC麻烦
1.创建Maven工程
2.引入依赖
org.springframework.boot
spring-boot-starter-parent
2.3.4.RELEASE
org.springframework.boot
spring-boot-starter-web
3.创建主程序
package com.cxy.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MainAppliaction {
public static void main(String[] args){
SpringApplication.run(MainAppliaction.class,args);
}
}
4.编写业务
package com.cxy.boot.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;
//@ResponseBody
//@Controller
@RestController
public class HelloController {
@ResponseBody
@RequestMapping("/hello")//映射请求
public String handle01(){
return "Hello Spring boot2!";
}
}
5.测试;运行main方法
6.简化配置:application.properties
7.简化部署:打成jar包,直接执行
org.springframework.boot
spring-boot-maven-plugin
注意取消CMD的快速依赖



