为了账号安全,请及时绑定邮箱和手机立即绑定

maven项目无法读取配置文件

maven项目无法读取配置文件

远飞的小马 2017-01-05 00:39:10
Spring-mvc<!-- 配置文件 --><bean id="configProperty"class="org.springframework.beans.factory.config.PropertiesFactoryBean"><property name="locations"><list><value>classpath*:setting.properties</value></list></property></bean><!-- 配置信息 --><bean id="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="ignoreResourceNotFound" value="false" /><property name="properties" value="configProperty" /></bean>Spring-Mybatis<!-- 配置数据源 --><bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"destroy-method="false"><property name="driverClassName"><value>${db.driver}</value></property><property name="url"><value>${db.url}</value></property><property name="username"><value>${db.username}</value></property><property name="password"><value>${db.password}</value></property><property name="initialSize"><value>5</value></property><property name="maxTotal"><value>50</value></property><property name="maxWaitMillis"><value>60000</value></property><property name="maxIdle"><value>20</value></property><property name="connectionProperties"><value>clientEncoding=UTF-8</value></property></bean><!-- 创建 sqlSessionFactory --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource" /><property name="configLocation" value="classpath:mybatis-config.xml" /></bean>setting.propertiesdb.driver=com.mysql.jdbc.Driverdb.url=jdbc:mysql://localhost:3306/live?useUnicode=true&characterEncoding=utf-8db.username=rootdb.password=rooteclipse 报错Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [spring-mybatis.xml]: Could not resolve placeholder 'db.driver' in string value "${db.driver}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'db.driver' in string value "${db.driver}"
查看完整描述

1 回答

  • 1 回答
  • 1 关注
  • 4498 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信