Spring Boot - 激活其他Profile的配置文件

时间:2018-04-10 19:57:18

标签: java spring spring-boot

我正在开发一个Spring启动应用程序,并希望有类似基本的配置文件继承。

我想知道如何归档以下内容:

if profile A.hello is active
then profile A.world needs to be activated as well

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:-1)

您可以通过自动装配环境变量

来获取活动配置文件
@Autowired
Environment environment;
...
environment.getActiveProfiles()
相关问题