本来心态好好的在写代码,测试了一小小下,措不及防给我来这么下,
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘studentServiceImpl’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘MStudentMapper’ defined in file [E:\桌面\springboot_pro\demo2\target\classes\com\example\demo2\mapper\MStudentMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mybatisPlusInterceptor’ defined in class path resource [com/example/demo2/config/MybatisPlusConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor]: Factory method ‘mybatisPlusInterceptor’ threw exception; nested exception is java.lang.NoClassDefFoundError: net/sf/jsqlparser/statement/select/SelectExpressionItem
几乎所有的bean都报错,完全找不到头绪,看了其他人问题解答,说是要加入druid的连接池依赖,
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.20</version>
</dependency>
但我加了也没有用,之前没加也可以啊,然后发现我的配置文件可能是项目加载问题,idea时常抽风,没有加载上(就是没有变spring绿叶),又手动配置了下,
也不行,service层、controller层、config文件都加了注解,还有启动类也加了mapper路径,还是毫无头绪。
我当时在做mybatisplus分页插件,我就把刚写的配置类给删除了,从新编译,发现项目可以启动,
当我又加上,发现果然又报错,思考了下,可能是因为我mapper路径下的studen采用的是用mybatis写的,可能两者有冲突导致的