Error creating bean with name ‘com.yangjunbo.JPADemo.UserRepositoryTest‘

阅读 83

2022-11-26


异常信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.yangjunbo.JPADemo.UserRepositoryTest’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.yangjunbo.JPADemo.repository.UserRepository’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

Error creating bean with name ‘com.yangjunbo.JPADemo.UserRepositoryTest‘_异常信息

问题描述:

今天在使用springboot程序进行测试的时候,运行测试方法,报了这个异常。

解决办法

经过检查,发现是因为测试类上少加了**@SpringBootTest**注解导致

Error creating bean with name ‘com.yangjunbo.JPADemo.UserRepositoryTest‘_spring_02


精彩评论(0)

0 0 举报