如何使用mybatis集合在转化时候报错的问题

  介绍

如何使用mybatis集合在转化时候报错的问题,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

, <强>问题描述:使用mybatis收集一对多关联查询时候,配置了懒加载模式,结果返回JSON,在转化时候报错。报错如下

 org.springframework.http.converter.HttpMessageConversionException:, Type  definition 错误:,(类型、simple  class  org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory $ EnhancedResultObjectProxyImpl];, nested  exception  is  com.fasterxml.jackson.databind.exc.InvalidDefinitionException:, No  serializer  found  for  class  org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory EnhancedResultObjectProxyImpl 美元;以及No  properties  discovered 用create  BeanSerializer (用avoid 例外,,disable  SerializationFeature.FAIL_ON_EMPTY_BEANS), (through 参考文档链:com.sesame.common.resp.RespJsonData (“responseData")→java.util.ArrayList [0]→com.sesame.goods.modual.model.dto.goods.GoodsCategoryChildListDTO_ $ $ _jvst11_0 [“handler"])
  at  org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal (AbstractJackson2HttpMessageConverter.java: 295), ~ (spring-web-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.http.converter.AbstractGenericHttpMessageConverter.write (AbstractGenericHttpMessageConverter.java: 102), ~ (spring-web-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters (AbstractMessageConverterMethodProcessor.java: 272), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue (RequestResponseBodyMethodProcessor.java: 180), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue (HandlerMethodReturnValueHandlerComposite.java: 82), ~ (spring-web-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod.java: 119), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter.java: 877), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdapter.java: 783), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java: 87), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java: 991), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java: 925), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java: 974), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet.java: 866), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  javax.servlet.http.HttpServlet.service (HttpServlet.java: 635), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java: 851), ~ (spring-webmvc-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  at  javax.servlet.http.HttpServlet.service (HttpServlet.java: 742), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 231), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 166), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java: 52), [tomcat-embed-websocket-8.5.32.jar 8.5.32):
  at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 193), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 166), ~ (tomcat-embed-core-8.5.32.jar 8.5.32):
  at  org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal (HttpTraceFilter.java: 90), [spring-boot-actuator-2.0.4.RELEASE.jar 2.0.4.RELEASE):
  at  org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java: 107), [spring-web-5.0.8.RELEASE.jar 5.0.8.RELEASE):
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null

如何使用mybatis集合在转化时候报错的问题