1. The concept of SpringBoot framework
1. Disadvantages of the traditional framework
For example, the traditional SSM framework integrates MyBatis、Spring、SpringMVC
the framework, but it requires cumbersome and repetitive configuration, which makes programmers very painful
2. Spring Boot framework
The SpringBoot framework further encapsulates it on the basis of the traditional framework. It only needs some simple configuration, which saves the cumbersome configuration of the traditional framework and liberates the programmers, so that the programmers only need to focus on the business without spending experience on the configuration of the framework. , greatly improving the efficiency of programming
Second, the creation of the SpringBoot framework
1. Idea creates SpringBoot project
(1) Create a Spring Initializr project
Note : It needs to be created in a networked environment
(2), configuration related information
Note : The path of the SpringBoot startup file is best set before subcontracting, because SpringBoot scans the subdirectory of its startup file. If the startup file is in the same directory as other files, it cannot be scanned
(3) Configure dependency files
3. The structure of SpringBoot
1. Maven structure
SpringBoot is actually an aggregation project, and its parent project is mainly used for version management
4. SpringBoot integrates MyBatis
1. yml file
yml file is a configuration file format, smaller and lighter than xml and properties
2. yml configuration mybatis
spring:
datasource:
url: jdbc:mysql://localhost:3306/car_express?characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver
username: ***
password: ***
mybatis:
type-aliases-package: com.qf.entity
mapper-locations: classpath:mapper/*Dao.xml
copy
Note: 1. SpringBoot spring-boot-starter-web
integrates SpringMVC when importing packages, which automatically integrates Spring 2. When importing others ORM框架
, it automatically integrates them, so SpringBoot isSpring+everyting
3. It can be seen that SpringBoot is a "universal framework"
Five, SpringBoot start
1. Start by the mean method in the SpringBoot startup file
Tomcat is built into SpringBoot, so tomcat can be started through the mean method of its startup file
@SpringBootApplication
public class SwaggerDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SwaggerDemoApplication.class, args);
}
}