<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"
p:basename="messages" />
bean and obviously in my velocity files I can use #springMessage() to get needed message. But what if I want to get that message in my *.java controller? Is there some annotation that I can use like ?
@Annotation('message')
private String message;
Or I need to do it in different way?
Thanks
As long as you don’t need any internationalization, then you can use the
messages.propertiesfile with aPropertyPlaceHolderConfigurer(see the docs), along with the@ValueannotationIn XML:
And in Java:
You’ll also need
<context:annotation-config/>to make this work (see docs)