一、极速开发框架SpringBoot及源码分析
官网:https://spring.io
特性
总结
二、springBoot开发环境
三、springBoot创建项目的三种方式
第一种方式:spring官网创建
第二种方式:阿里云创建
第三种方式:maven创建自己创建目录加入jar包
四、springBoot开发java程序
一、springboot开启启动类
二、springboot的log
关闭Log
开启Log
自定义Log
在项目目录下resource下创建Banner.txt文件,就是log输出
在配置文件application.propertise配置信息
none代表java程序
servlet代表web程序
使用流式启动
new SpringApplicationBuilder()
.sources(Application.class)
.bannerMode(Banner.Mode.CONSOLE)
.run(args);
//在配置文件种开启
spring.main.allow-bean-defintion-overriding=true
springBoot的run方法执行完后调用的类
启动类上implements 实现 CommandLineRunner接口 重写run方法
public void run(String...args) throws Exception{
//spring ioc 自动完之后会回调该方法
Systemp.out.println("springBoot自动完成了");
}
五、springBoot开发web程序
一、搭建SpringBoot的web程序
修改pom.xml文件
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
在启动类上加上Controller
编写方法
@ResponseBody是返回String类型
二、修改web程序的配置项
application.properties配置文件种
server.port=80//修改端口
程序参数修改端口
三、修改内嵌的tomcat版本
当前版本
在pom.xml文件中修改
修改完后查看