xml中从配置文件读取配置信息

两种方法:

1、PropertyPlaceholderConfigurer

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

 2、context:property-placeholder

<context:property-placeholder location="classpath:jdbc.properties,classpath:hibernate.properties"/>

 

posted @ 2019-03-26 15:53  程序员张3  阅读(3)  评论(0编辑  收藏  举报