SqlSessionFactoryBeanName

PropertyPlaceholderConfigurer 无效的问题

房东的猫 提交于 2019-11-28 14:27:59
问题描述: 这两天自己配置SPring+MyBatis遇到了个问题,搞了一天才搞定。就是PropertyPlaceholderConfigurer加载配置之后在DatasSource中的使用无效的问题。 以下是配置 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:properties/database.properties</value> </list> </property> <property name="fileEncoding" value="utf-8"></property> </bean> <!-- 数据源1 --> <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"> <!-- 数据库基本信息配置 --> <property name="url" value="${jdbc.url}"/> <property name="driverClassName" value="${jdbc.driver}"/>