I am using the spring @Value annotation to load a property into my controller from a file.
In my controller....
@Value("#{messagesProperties['confirm.priceOverride.fourWeeksOrMore']}")
public String recallOfFourWeeksOrMoreConfirm = null;
In my messagesProperties properties file...
confirm.priceOverride.fourWeeksOrMore=You have chosen to recall historical data older than four weeks of age. Do you wish to continue?
This works but I would now like to put a placeholder in the property file to replace the word four. For example...
confirm.priceOverride.fourWeeksOrMore=You have chosen to recall historical data older than {0} weeks of age. Do you wish to continue?
The {0} specified in the properties file will be replaced with a value returned from the database which I can get using the following code...
Integer priceOverrideRetentionDays = appParamsManager.getPriceOverrideRetentionDays();
I guess one of the ways I can do this is to just do a string replace but there is probably a better way than that to do what I need.
Can someone please help me with how?
thanks
Aucun commentaire:
Enregistrer un commentaire