When developing an application, sometimes you want to support many different configurations, so you use different profiles.
This means that you will have one properties file for each profile, application-a.properties
, application-b.properties
and so on.
Now many things in these profiles are the same and some stuffs are different. This leads to a lot of duplication and could lead to problems later on.
Is there a way to remove this properties duplication?
Is there a way to remove this properties duplication?
Put common cross-profile properties in application.properties
and just profile specific properties into application-{profile}.properties
. When you enable a specific profile, application.properties
still will be used but will lower precedence with respect to the profile specific ones. Checkout Spring Boot documentation for more detailed discussion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.