messagesource读取properties

xml中配置:

<bean id="messageSource"
		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
		<property name="basenames">
			<array>
				<value>classpath:web</value>
			</array>
		</property>
	</bean>

程序中注入:

@Resource
	private MessageSource messageSource;

获取:

String username = messageSource.getMessage("username", new Object[]{}, LocaleContextHolder.getLocale());


你可能感兴趣的:(messagesource读取properties)