当前位置:   article > 正文

SpringBoot3和mybatisplus整合出现的问题_bean named 'ddlapplicationrunner' is expected to b

bean named 'ddlapplicationrunner' is expected to be of type 'org.springframe

Invalid value type for attribute ‘factoryBeanObjectType’: java.lang.String

springboo3和mybatisplus整合出现Invalid value type for attribute ‘factoryBeanObjectType’: java.lang.String错误,原因是

<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.5.4.1</version>
</dependency>

依赖内部内部的

<dependency>
    <artifactId>mybatis-spring</artifactId>
    <groupId>org.mybatis</groupId>
</dependency>

依赖版本过低

处理方案是,排除原有的版本,引入新的依赖版本

<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.5.4.1</version>
    <exclusions>
        <exclusion>
            <artifactId>mybatis-spring</artifactId>
            <groupId>org.mybatis</groupId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>3.0.3</version>
</dependency>

同时又会出现错误

Bean named 'ddlApplicationRunner' is expected to be of type 'org.springframework.boot.Runner' but was actually of type 'org.springframework.beans.factory.support.NullBean'

需要注入一个名为DdlApplicationRunner的Bean

@Bean
public DdlApplicationRunner ddlApplicationRunner(@Autowired(required = false) List ddlList) {
    return new DdlApplicationRunner(ddlList);
}
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/1018787
推荐阅读
相关标签
  

闽ICP备14008679号