如何制作特定于配置文件的 bootstrap.yml?
How can I make a profile-specific bootstrap.yml?
我想根据传递给启动应用程序的 spring 配置文件在 bootstrap.yml
文件中使用不同的 属性 值(与 [=12= 的工作方式相同) ]).
怎么可能?
根据文档,它的工作原理应该差不多。
Changing the Location of Bootstrap Properties:
If there is an active profile (from spring.profiles.active
or through the Environment
API in the context you are building), properties in that profile get loaded as well, the same as in a regular Spring Boot app — for example, from bootstrap-development.properties
for a development
profile.
也就是说,应该可以在 bootstrap yaml 后缀加上环境名称使其生效。
我想根据传递给启动应用程序的 spring 配置文件在 bootstrap.yml
文件中使用不同的 属性 值(与 [=12= 的工作方式相同) ]).
怎么可能?
根据文档,它的工作原理应该差不多。
Changing the Location of Bootstrap Properties:
If there is an active profile (from
spring.profiles.active
or through theEnvironment
API in the context you are building), properties in that profile get loaded as well, the same as in a regular Spring Boot app — for example, frombootstrap-development.properties
for adevelopment
profile.
也就是说,应该可以在 bootstrap yaml 后缀加上环境名称使其生效。