首页 > 数据库技术 > 详细

用properties文件读取数据库的配置文件

时间:2015-12-15 12:26:21      阅读:176      评论:0      收藏:0      [点我收藏+]
当properties文件在src目录下时!!!以下三种路径都是正确的。(经过实验验证都可以读到配置文件),classpath不需要大写字母
<bean id="property"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>classpath:jdbc.properties</value>
        </property>
    </bean>

<bean id="property"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>jdbc.properties</value>
        </property>
    </bean>

<bean id="property"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>/jdbc.properties</value>
        </property>
    </bean>

 

用properties文件读取数据库的配置文件

原文:http://www.cnblogs.com/2027437606qq/p/5047717.html

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