spring 配置文件 引入外部的property文件的两种方法

时间:2023-03-08 20:11:03
spring 配置文件  引入外部的property文件的两种方法

spring  的配置文件

引入外部的property文件的两种方法

<!-- 引入jdbc配置文件    方法一 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!--要是有多个配置文件,只需在这里继续添加即可 -->
<value>classpath:properties/*.properties</value>
</list>
</property>
</bean>

<!-- 引入jdbc配置文件    方法二 -->

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