且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在使用PropertiesLauncher启动的Spring-boot(特定于配置文件)应用程序中发出覆盖应用程序属性的问题

更新时间:2023-10-18 22:24:22

谢谢,戴夫,你的建议是100%正确的。

Thanks, Dave, your suggestion was 100% correct.

如果我将 / local / appname / dev / overrides 中的属性文件重命名为 application-dev.properties 然后该文件 执行 的属性值将覆盖类路径中的属性值:application-dev.properties

If I rename the properties file in /local/appname/dev/overrides to application-dev.properties then the property values from that file do override the ones in classpath:application-dev.properties.

我确信我已经昨天试过这个组合,但我认为必须停止它的工作是当我正在玩指定 spring.config.location 并且出错了所以它没有在正确的位置查找覆盖文件。

I was sure I had tried this combination yesterday, but I think what must have stopped it working was when I was playing around with specifying the spring.config.location and got that wrong so it wasn't looking for the override file in the right place.