Spring 解析资源文件
我们把资源信息放置到properties文件中
通过配制bean来访问资源文件
<bean id="messageSource" class="org.springframework.context.support
ResourceBundleMessageSource">
<property name="basename">
<value>fileName</value>
</property>
</bean>
其中bean的名字必须是messageSource。
context.getMessage("computer",new Object[0],locale)得到computer的值。
<spring:message code="computer"/>
我们把资源信息放置到properties文件中
通过配制bean来访问资源文件
<bean id="messageSource" class="org.springframework.context.support
ResourceBundleMessageSource">
<property name="basename">
<value>fileName</value>
</property>
</bean>
其中bean的名字必须是messageSource。
context.getMessage("computer",new Object[0],locale)得到computer的值。
<spring:message code="computer"/>
本文介绍如何使用Spring框架解析properties资源文件。通过配置bean的方式访问文件,并获取特定属性的值。
522

被折叠的 条评论
为什么被折叠?



