nested exception is java.lang.NoClassDefFoundError: lombok/Data

在未更改lombok的依赖的情况下本次提交未涉及报错中的类,报错了

2022-12-10 11:33:28.217 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchUploadExcel': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadBehaviorHistoryDao' defined in URL [jar:file:/C:/back-1.0.jar!/BOOT-INF/classes!/com/bluesnow/cal/dao/UploadBehaviorHistoryDao.class]: Cannot resolve reference to bean 'sqlSessionTemplate' while setting bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionTemplate' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionTemplate' parameter 0; nested exception is 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.NoClassDefFoundError: lombok/Data

img

你看看你代码里是不是有泛型定义为Data了

应该是你的 实体类加了 @Data 注解导致的,这其实就是为了让编译器在编译时,自动将实体类中get,set,toString等方法自动插入到编译的class文件中,这样你的实体类就很简洁,只有变量定义,虽然java文件没有,但可以直接使用对应的get,set方法


像你不需要这个的话,直接去掉这个注解,补全类的get set等方法就可以了


@Data 注解参考
https://blog.csdn.net/zy103118/article/details/126259157

java如何在编译时处理注解,这也是 @Data 的实现机制

楼主最后怎么解决的呢?