标签:load Java Spring factory springframework nested bean beans org
项目功能:
连接MySql数据库,向数据库插入一条数据
项目结构:
DEBUG信息:
DEBUG [main] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@67b92f0a: defining beans
[org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,studentService,studentDao,dataSource]; root of factory hierarchy
juint信息:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'studentService' defined in class path resource [applicationContext.xml]:
Cannot resolve reference to bean 'studentDao' while setting bean property 'studentDao';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'studentDao' defined in class path resource [applicationContext.xml]:
Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [${jdbc.driverClass]
分析:
1.配置文件出错。
(1)检测jdbc.properties————————————没有错误
(2)检测applicationContext.xml————————没有错误
2.JAR包错误
(1)重新导包————————————————解决错误,成功连接数据库,插入数据。
问题原因:
产生错误时使用的Jar包: 重新导入的Jar包:
缺少mysql-connector-java-5.1.13-bin.jar包!!
所以报的是无法找到驱动。
标签:load,Java,Spring,factory,springframework,nested,bean,beans,org 来源: https://www.cnblogs.com/PinkManBlog/p/11027787.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。