我们有一个 springboot 应用程序打包到一个 jar 中。打包时,我们将除 application.properties
文件外的所有配置属性文件都打包到 jar 文件中。
现在,我们确实需要编辑打包在 jar 中的配置文件中的一些键。文件名为 messages.properties
,其中包含一些错误键和值。
为了覆盖 jar 外部的 messages.properties
,我们确实在 resources
文件夹中创建了一个 message.properties
并重新启动了应用程序,但是应用程序仍然指向捆绑在 jar 中的 messages.properties
文件。
现在,我的问题是有没有一种方法可以覆盖 messages.properties
或 messages.properties
文件中的键而不对 jar 文件做任何更改?
我已尽力以最佳形式提出问题,如果您需要更多详细信息,请告诉我。
非常感谢。
最佳答案
试试这个方法,
定义一个 newmessage.properties 键被值覆盖,把它放在资源文件夹中,在你的application.properties 添加
spring.messages.basename = newmessage
关于java - 覆盖 spring boot 包 jar 中的 messages.properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40536708/