Spring Boot configuration file comparison of the two configurations

Spring Boot java development framework to address complicated xml configuration allows us to quickly build a foundation java project

Spring Boot profile support .yml also supports .properties YML configuration is loaded ordered .properties disorder

application.yml arrangement

Spring:
file application:
name: wxxcx
MVC:
View:
prefix: / the WEB-INF / JSP /
suffix: JSP
application.yml arrangement

= wxxcx spring.application.name
the server.port = 9000
server.context-path = /
server.tomcat.uri. 8-encoding = UTF-
spring.mvc.view.prefix = / the WEB-INF / JSP /
spring.mvc.view .suffix = .jsp
see yml trapezoidal configuration similar hierarchical structure, Note: the composition of the top-down stage names must be unique, such as a first stage here again there is no additional spring has a spring configuration information is called a .

Switch configuration file.

Profiles are usually sub-dev development environment, test environment, test, prod production environment

You can create a project in

application-dev.yml application-test.yml application-prod.yml three profiles

Application.yml create a single configuration file, configuration is as follows

Spring:
Profiles:
Active: dev
handover profile by setting spring.profiles.active manner, may be started by entering the jar when the package or bag war

--spring.profiles.active = test manner.

Guess you like

Origin blog.51cto.com/11156310/2424357
Recommended