码迷,mamicode.com
首页 > 编程语言 > 详细

org.springframework.beans.factory.BeanDefinitionStoreException异常

时间:2017-03-25 20:09:57      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:exce   classes   ace   name   stop   环境   com   users   中文翻译   

1、下面是我遇到的异常信息:

2017-03-25 18:01:11,322 [localhost-startStop-1] [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed

org.springframework.beans.factory.BeanDefinitionStoreException:

Invalid bean definition with name ‘dataSource‘ defined in file [C:\Users\Aaron\workspace\HT\target\classes\spring\applicationContext.xml]:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}";

nested exception is java.lang.IllegalArgumentException:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}"

2、异常信息中文翻译:

Context initialization failed: 

环境初始化失败

BeanDefinitionStoreException:  

这是一个异常对象:java bean 定义、注入异常

Invalid bean definition with name ‘dataSource‘ defined in file:

无效的 java bean 定义,使用文件C:\Users\Aaron\workspace\HT\target\classes\spring\applicationContext.xml 为 dataSourece 类定义属性时出错:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}";

不能解析占位符 ‘jdbc.driver‘ in string value "${jdbc.driver}";

IllegalArgumentException

非法参数异常

3、查找错误

3.1 在 applicationContext.xml 里有如下配置:

  <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
    <property name="driverClassName" value="${jdbc.driver}"/>

3.2 在 db-mysql.properties 里有如下配置:

  jdbc.driverClassName=com.mysql.jdbc.Driver

3.3 value的变量名为jdbc.driver,但在properties里配置的却是jdbc.driverClassName

4、解决办法

  修改db-mysql.properties文件如下:

  jdbc.driver=com.mysql.jdbc.Driver

  

 

org.springframework.beans.factory.BeanDefinitionStoreException异常

标签:exce   classes   ace   name   stop   环境   com   users   中文翻译   

原文地址:http://www.cnblogs.com/BaiLaowu/p/6618048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!