say in front:
The simplest configuration for getting started is described in the previous spring boot, and spring boot is an integrated thing with a lot of related configurations already configured, and by default you don't need to start a container such as Tomcat,
Also do not need application configuration 、、、 basically the common configuration has been integrated configuration. Of course, since this thing can be used for everyone, it must be open a lot of interfaces or file coverage, that is, we can also hand
To override the spring boot default configuration, the following is a description of some of the commonly used overlay configurations for comparison basics:
1. configuration File Settings
Spring boot will load the Application.properties configuration file under the Resources directory by default, so basically the relevant parameters will be configured in the properties file.
As shown in figure:
Of course, you can also set other types of profiles according to project requirements, such as development lines, test lines, or production lines, configured in Application.properties:
Such as:
#设置环境配置
Spring.profiles.active=dev
You can load the Application-dev.properties configuration file under the resources directory, which is: automatically read the application-*.properties file for configuration.
2. Port Settings
The default is to use port 8080, which can be configured in the properties file
server.port=8088
3, the configuration project name,
The default is no project name, which can be configured in the properties file
Server.contextpath=/spring_boot
4. Configure Spring HTTP request encoding
Spring.http.encoding.charset=utf-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
5. Configure log log output
The default is to use Logback for log management
#日志
logging.file=/export/log
logging.level.root=info
logging.level.org.springframework.web=info
Logging.level.sample.mybatis.mapper=trace
6. Configuration (switch) Start command logo
The spring logo is printed by default when you start
Can remove this logo or replace, configure
#关闭启动Logo
Spring.main.banner-mode=off
7. Database Connection Configuration
Spring.datasource.url=jdbc:mysql://localhost:3306/test
Spring.datasource.username=root
spring.datasource.password=123456
Spring.datasource.driver-class-name=com.mysql.jdbc.driver
8, the page icon ico configuration
Spring boot will be a green leaf icon when it is accessed by default.
The icon can be replaced by simply placing the custom ICO icon in the Resources directory
Note: The name needs to be set to the default name Favicon.ico
9, mybites configuration:
Can be configured in the properties file:
#mybatis配置
Mybatis.type-aliases-package=com.sam.project.*.model
mybatis.mapper-locations=classpath: Mapper/*.xml