简体   繁体   中英

Overriding messages.properties in a springboot packaged jar

We have a springboot app packaged into a jar. While packaging, we bundled all config property files into the jar file except application.properties file.

Now, we do have a requirement to edit some keys inside a config file which is packaged in the jar. The file name is messages.properties which contains some error keys and values.

To override the messages.properties outside the jar, we did create a message.properties in resources folder and restarted the app, but app was still pointing to the messages.properties file bundled in the jar.

Now, my question is there a way we can override the messages.properties or the keys inside the messages.properties file without making any changes to the jar file?

I've tried my best to put the question in its best form, in case if you need more details please do let me know.

Many Thanks in advance.

try this approach,

define a newmessage.properties with key overridden with values , put it in resource folder, in your application.properties add

spring.messages.basename = newmessage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM