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

来源:2-6 逐层完成SSM的各项配置

慕圣838846

2020-11-19

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
图片描述

写回答

2回答

慕圣838846

提问者

2020-11-20

老师  辛苦了   这么晚还在回答   我查了下  网上说是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].

//img.mukewang.com/szimg/5fb71b2e096452a014370304.jpg

0
1
翔仔
同学好,应该是你的jdbc.properties文件读取不到或者是相关变量没有赋值 Could not resolve placeholder 'jdbc.username' in value "${jdbc.username}" 这里说的是你虽然指定了${jdbc.username}占位符但是没有给它赋值
2020-11-21
共1条回复

翔仔

2020-11-20

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

0
0

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程