Spring读取Properties文件
<context:property-placeholder location="classpath:db.properties"/>
我本地用的Spring-beans-5.2.3无法使用<context:property-placeholder/>属性,因为PropertyPlaceholderConfigurer已经被弃用,使用其他方式:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations" value="classpath:db.properties"></property> <property name="fileEncoding" value="utf-8"></property> </bean>
需要配置resources类路径