1.Spring Boot 可以轻松创建可以“直接运行”的独立的、生产级的基于 Spring 的应用程序。
2.内置web的服务器(如tomcat,jetty等),我们不再需要对服务器进行部署设置
3.我们不再需要编写大量的配置文件,springBoot会为我们自动搭建,我们只需要关注程序的编写
4.SpringBoot是整合Spring技术栈的一站式框架,是简化Spring技术栈的快速开发脚手架
2.第一个springBoot程序1.系统要求
java8及以上吗,maven3.3+
maven的setting设置(设置阿里云镜像等)
nexus-aliyun central Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public jdk-1.8 true1.8 1.8 1.8 1.8
2.想要实现的功能:浏览器发送/hello的请求,响应hello,springBoot2
3.创建maven工程,引入依赖
org.springframework.boot spring-boot-starter-parent2.3.4.RELEASE org.springframework.boot spring-boot-starter-web
4.创建主程序
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}
5.在controller中编写程序业务
@RestController //上面两个注解的合体
public class HelloController {
@RequestMapping("/hello")
public String handle01() {
return "hello,springBoot";
}
}
6.可以在resources目录中创建application.properties文件中简化配置,如设置服务器端口号
server.port=8888
7.测试--直接运行主程序中的main方法
这样,我们就实现了第一个springBoot项目



