问答详情
源自:8-2 整合MyBatis - 实现基于mybatis的CRUD功能

一直报错说 找不到bean

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myBatisCRUDController': Unsatisfied dependency expressed through field 'clothService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clothServiceImpl': Unsatisfied dependency expressed through field 'clothMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clothMapper' defined in file [F:\Project\target\classes\com\abc\mapper\ClothMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [tk/mybatis/mapper/autoconfigure/MapperAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedDataBinder

提问者:qq_慕仰5357935 2018-11-25 22:16

个回答

  • 慕UI1182074
    2019-12-13 17:25:08

    解决了吗?


  • 慕UI1182074
    2019-12-13 17:24:39

    我也是这个错

  • 慕容0877342
    2019-03-07 11:05:47

    NoClassDefFoundError: org/springframework/boot/bind/RelaxedDataBinder

    boot里面找不到包,org.springframework.boot.bind 包已经删掉了,导致RelaxedPropertyResolver这个方法已经不可用了.

    <dependency>
        <groupId>com.alibaba</groupId>
       <artifactId>druid-spring-boot-starter</artifactId>
       <version>1.1.0</version>
    </dependency>

    这个依赖删掉即可~~

  • 梦你九千
    2018-12-22 16:44:43

    我也启动报错,找不到这个注入的service的Bean,注解都没少,对着老师的代码写的,到底在哪配置的bean啊?

  • 等闲故人心
    2018-11-26 13:12:17

    看看少不少注解 @RestController 以及 'myBatisCRUDController'里面的接口上面有没有@Autowried