Spring Boot change value properties file -
hi i'm using spring boot. dynamically replace contents of variable in properties file.
this file: message.properties
message=welcome ${bean.name} website
i know if there way change value of variable. thanks
if comes messages.properties
file, don't have change dynamically content. instead can use message variables. take @ example:
messages.properties:
message=welcome {0} website
if process message using messagesource
bean, can message with:
messagesource.getmessage("message", new object[] { "test" }, localecontextholder.getlocale())
the returned string in case is:
welcome test website
of course need inject messagesource
class (controller,service) before can use exemplary code:
@autowired messagesource messagesource
Comments
Post a Comment