spring框架中设置配置文件
2017-02-07 14:11:45    139    0    0
althars

1 新建 properties格式文件 设置 key=value格式的值
2 在配置文件中注入 bean
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:configfilename.properties</value>
</list>
</property>
</bean>



3 用private final String key = ResourceBundle.getBundle("configfilename").getString("key");获取相应的值

Pre: springmvc+spring+hibernate整合框架实例

Next: JAVA访问路径

139
Sign in to leave a comment.
No Leanote account? Sign up now.
0 comments
Table of content