想要检查Spring Boot是否提供帮助来使用配置文件,而不是application.properties
文件。例如:my-custom.properties可以是特定于配置文件的文件:my-custom-dev.properties
for dev个人资料my-custom-uat.properties
对于[[uatapplication-{env}.property
文件,除此之外,还有其他属性文件与它们的数据内容一致(例如:我想存储在db- log.properties,如何使其他文件配置文件敏感?想要检查Spring Boot是否提供帮助,以使用application.properties文件以外的配置文件。例如:可以是特定于配置文件的my-custom.properties文件:...
application.properties
文件之外,您还可以根据需要定义为application-{profile}.properties
。所选文件将在启动后根据您选择的配置文件确定。 特定于配置文件的属性可以通过以下约定定义:application- {profile} .properties。
您也可以使用bootstrap.properties文件,并可以指定spring.application.name = my-custom
@Configuration
@PropertySource("classpath:my-custom-${spring.profiles.active}.properties")
-Dspring.profiles.active=prod