springboot多模块报错分析(一)

  1. Lombok 注解与 Jackson 序列化冲突
2025-11-13 [http-nio-8089-exec-1] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]- Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-11-13 [http-nio-8089-exec-1] INFO  org.springframework.web.servlet.DispatcherServlet- Initializing Servlet 'dispatcherServlet'
2025-11-13 [http-nio-8089-exec-1] INFO  org.springframework.web.servlet.DispatcherServlet- Completed initialization in 1 ms
2025-11-13 [http-nio-8089-exec-9] WARN  org.springframework.http.converter.json.MappingJackson2HttpMessageConverter- Failed to evaluate Jackson deserialization for type [[simple type, class com.xq.web.sys_role.entity.SysRole]]: com.fasterxml.jackson.databind.JsonMappingException: Cannot deserialize Class lombok.Data (of type annotation) as a Bean
2025-11-13 [http-nio-8089-exec-9] WARN  org.springframework.http.converter.json.MappingJackson2HttpMessageConverter- Failed to evaluate Jackson deserialization for type [[simple type, class com.xq.web.sys_role.entity.SysRole]]: com.fasterxml.jackson.databind.JsonMappingException: Cannot deserialize Class lombok.Data (of type annotation) as a Bean
2025-11-13 [http-nio-8089-exec-9] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver- Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported]
2025-11-13 [http-nio-8089-exec-10] WARN  org.springframework.http.converter.json.MappingJackson2HttpMessageConverter- Failed to evaluate Jackson deserialization for type [[simple type, class com.xq.web.sys_role.entity.SysRole]]: com.fasterxml.jackson.databind.JsonMappingException: Cannot deserialize Class lombok.Data (of type annotation) as a Bean
2025-11-13 [http-nio-8089-exec-10] WARN  org.springframework.http.converter.json.MappingJackson2HttpMessageConverter- Failed to evaluate Jackson deserialization for type [[simple type, class com.xq.web.sys_role.entity.SysRole]]: com.fasterxml.jackson.databind.JsonMappingException: Cannot deserialize Class lombok.Data (of type annotation) as a Bean
2025-11-13 [http-nio-8089-exec-10] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver- Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported]

image
原因:我在SysRole实体类中使用了lombox的Data数据类型
解决:导入import java.util.Date;,日期类型使用的是该类
2.运行时候用到其他模块的资源怎么办:Spring 无法创建 SysRoleController 实例,根源是无法解析该类(通常因依赖缺失、类加载失败或注解冲突导致)

[main] ERROR org.springframework.boot.SpringApplication- Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysRoleController': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.xq.web.sys_role.controller.SysRoleController] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPos

解决:进入其他模块,执行命令mvn clean install,之后正常运行程序

posted @ 2025-11-15 21:39  f-52Hertz  阅读(8)  评论(0)    收藏  举报