方式一:
bean注入方式:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations"> <!-- PropertyPlaceholderConfigurer類中有個locations屬性,接收的是一個數組,即我們可以在下面配好多個properties文件 -->
<array>
<value>classpath:jdbc.properties</value>
</array>
</property>
</bean>
方式二:
註解方式:
<context:property-placeholder location="classpath:conn.properties"/><!-- 加載配置文件 -->