springboot+mybatis-plus集成报错Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required等问题

尝试网上众多方法后,仍无法解决。提供一种思路,mybatis-plus版本问题.

报错:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.IllegalStateException: Cannot enable lazy loading because Javassist is not available. Add Javassist to your classpath.

报错之前的pom.xml

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

更改mybatis-plus版本,启动项目,运行成功。

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



猜你喜欢

转载自blog.csdn.net/qq_44464101/article/details/120622062
今日推荐