通过 Maven 在 SpringBoot 中配置活动配置文件
2022-08-31 13:44:48
我正在尝试使用Maven 3在Spring Boot应用程序中设置活动配置文件。
在我的pom.xml我将默认的活动配置文件和属性spring.profiles.active设置为开发:
<profiles>
<profile>
<id>development</id>
<properties>
<spring.profiles.active>development</spring.profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
但每次运行应用程序时,我都会在日志中收到以下消息:
No active profile set, falling back to default profiles: default
并且 SpringBoot 配置文件设置为默认值(读取 application.properties 而不是 application-development.properties)
我还应该做些什么来使用 Maven 配置文件设置我的 SpringBoot 活动配置文件?
任何帮助都非常感谢。