Table of contents
Three configuration file types
Property disappearing solution
basic configuration
attribute configuration
Modify server port
Just write in Application.properties
# 应用服务 WEB 访问端口
server.port=80
after running
access
Modify the output banner (logo)
The default is this
can be turned off to generate this
#关闭banner
spring.main.banner-mode=off
It doesn't appear after running
We can import the text or pictures we want in the configuration file, and springboot will automatically generate them for us. After importing, we can put them under resource
#修改logo
spring.banner.image.location=图片或文件位置
I imported the picture here.
set log
#日志
logging.level.root=debug
Set to debug level, there are many, from initialization to build successfully printed out. Generally, it will be used only when it is adjusted incorrectly
The normal log is info (default)
#日志
logging.level.root=info
error level, that is, only when there is an error will there be a log.
#日志
logging.level.root=error
View all configuration configurations in springbooot official website
Ctrl+f searches for related configurations, which can be ambiguously queried
summary:
Each configuration corresponds to a technology
After importing the corresponding starter in SpringBoot, provide the corresponding configuration properties
Writing SpringBoot configuration is written in the form of keywords + prompts
Three configuration file types
application.yml (mainstream)
server:
port: 81
application.yaml
server:
port: 82
application.properties
server.port=80
When three profiles coexist
The priority among them is
properties>yml>yaml
The same configuration in different configuration files will be kept according to the higher priority.
If there is 1 in file a, 2 in file b, and 3 in file c, then it will be 123 in the end.
Property disappearing solution
In the yml and yaml configurations, the input attributes are not prompted. The prompt scheme is provided by idea, not by springboot. There is no prompt in idea because idea thinks this is not a configuration file.
when finished
This tells idea that they are all configuration files, and there are prompt messages