• 测试类中出现的异常


    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

  • 相关阅读:
    商城02——dubbo框架整合_商品列表查询实现_分页
    商城项目01——工程介绍及搭建
    利用ssm框架做一个客户管理系统
    SpringMVC学习笔记
    spring问题
    Spring学习笔记
    MyBatis学习笔记二
    MyBatis学习笔记
    二分查找与几种排序方法
    配置 spring boot 的 banner (自定义或取消banner)
  • 原文地址:https://www.cnblogs.com/lvhouhou/p/13429829.html
Copyright © 2020-2023  润新知