首页 > 编程语言 > 详细

spring bean 读取外部properties文件

时间:2018-10-10 16:44:28      阅读:233      评论:0      收藏:0      [点我收藏+]

方法一:利用org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

    <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:test.properties</value>
            </list>
        </property>
        <property name="fileEncoding" value="UTF-8"/>
    </bean>

方法二:利用context:property-placeholder

    <context:property-placeholder location="classpath:test.properties" file-encoding="utf-8"/>

spring bean 读取外部properties文件

原文:https://www.cnblogs.com/caohui/p/9767026.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!