请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

老师 我这个报错是什么问题

ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5a8e6209] to prepare test instance [com.imooc.o2o.dao.AreaDaoTest@7494e528]
java.lang.IllegalStateException: Failed to load ApplicationContext
图片描述

正在回答 回答被采纳积分+3

2回答

提问者 慕圣838846 2020-11-20 09:26:09

老师  辛苦了   这么晚还在回答   我查了下  网上说是idk版本不对  是这样吗?

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'DataSource' defined in class path resource [spring/spring-dao.xml]: Could not resolve placeholder 'jdbc.username' in value "${jdbc.username}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.username' in value "${jdbc.username}"

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.username' in value "${jdbc.username}"

09:09:18.956 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - After test class: context [DefaultTestContext@4973813a testClass = AreaDaoTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@6321e813 testClass = AreaDaoTest, locations = '{classpath:spring/spring-dao.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with @DirtiesContext [false] with mode [null].

https://img1.sycdn.imooc.com//szimg/5fb71b2e096452a014370304.jpg

0 回复 有任何疑惑可以回复我~
  • 翔仔 #1
    同学好,应该是你的jdbc.properties文件读取不到或者是相关变量没有赋值
     Could not resolve placeholder 'jdbc.username' in value "${jdbc.username}"
    这里说的是你虽然指定了${jdbc.username}占位符但是没有给它赋值
    回复 有任何疑惑可以回复我~ 2020-11-21 00:11:18
翔仔 2020-11-20 02:20:03

同学好,辛苦提供下caused by 附近的语句,也可以将caused by附近的语句贴百度上查查。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信