1.Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lhh.myspringboot.service.AdminService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 

原因:少注解@Service

 

2. Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminServiceImpl': Unsatisfied dependency expressed through field 'adminDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lhh.myspringboot.dao.AdminDao' available: expected at least 1 bean which qualifies as autowire candidate. 

 

解决:

测试类中出现的异常

 

3.org.junit.runners.model.InvalidTestClassError: Invalid test class 'com.lhh.myspringboot.MySpringbootApplicationTests':

1. Method adminTest() should be public
2. Method contextLoads() should be public

解决:  测试类方法应当是public

 

4.org.junit.runners.model.InvalidTestClassError: Invalid test class 'com.lhh.myspringboot.MySpringbootApplicationTests':

1. No runnable methods

解决: junit导包有误,应该导 org.junit.Test

测试类中出现的异常

 

 

相关文章:

  • 2021-05-14
  • 2022-02-24
  • 2021-06-18
  • 2022-12-23
  • 2021-12-22
  • 2021-11-07
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
相关资源
相似解决方案