Java – how to load property files based on spring configuration files

How to create a project architecture to support multiple environments With the help of spring, each environment will have different data sources from different property files, such as (DEV properties file, test property fil, production property file)

org.springframework.core.env.Environment;

Solution

Put the properties file in the same place as application Property, and then follow

In application Set spring. In properties profiles. Active = dev, test, etc

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>