我在 src/main/resources 下创建了 2 个文件:
- 应用程序属性
- application-local.properties
第一个具有从环境变量中获取值的属性,而后者具有固定值。
根据具体here ,我是这样启动spring boot的:
mvn spring-boot:run -Dspring.profiles.active=local
但是没有产生任何效果,并且 application-local.properties 似乎被忽略。
有什么提示吗?
最佳答案
是的,如果您使用 spring-boot 插件运行,则必须使用 -Dspring-boot.run.profiles
传递配置文件,请尝试
mvn spring-boot:run -Dspring-boot.run.profiles=local
关于java - Spring Boot,使用 application-{profile}.properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72391974/