获取Java代码中的消息(Spring 3)

|
<bean id=\"messageSource\" class=\"org.springframework.context.support.ResourceBundleMessageSource\"
        p:basename=\"messages\" />
Bean,显然在速度文件中,我可以使用#springMessage()获取所需的消息。但是,如果我想在我的* .java控制器中获取该消息怎么办?有一些我可以使用的注释吗?
@Annotation(\'message\')
private String message;
还是我需要以不同的方式来做? 谢谢     
已邀请:
只要您不需要任何国际化,就可以将
messages.properties
文件与ѭ3use一起使用(请参阅文档)以及
@Value
注释 在XML中:
<bean class=\"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer\">
   <property name=\"locations\" value=\"classpath:messages.properties\"/>
</bean>
在Java中:
@Value(\'message\')
private String message;
您还需要ѭ7才能完成此工作(请参阅文档)     

要回复问题请先登录注册