【问题标题】:Supplying profile name for Spring Profile为 Spring Profile 提供配置文件名称
【发布时间】:2021-02-25 07:18:30
【问题描述】:

我通过在 application.properties 文件中设置属性 spring.profiles.active 在我的 Spring Boot 应用程序中使用 Spring Profiles。

但是,如果我使用 JVM 系统参数方式提供配置文件名称且文件中仍然存在 spring.profiles.active 属性,它会覆盖文件值吗?

JVM系统参数方式:

-Dspring.profiles.active=dev

【问题讨论】:

  • 从 maven 或 java 开始,因为它已经构建好了?

标签: java spring spring-boot spring-profiles


【解决方案1】:

它将出现在文件中。命令行参数将优先于文件属性。

这些配置文件将在应用程序启动期间激活。

【讨论】:

  • 这就是我想要的。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-04-28
  • 1970-01-01
  • 2019-06-15
  • 1970-01-01
  • 1970-01-01
  • 2016-12-11
  • 1970-01-01
相关资源
最近更新 更多