org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.

当我用Springboot和mybatis进行延迟加载时候报出如下的错误:

org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

这里我的解决方法是在yml的配置中设置:

spring:
  jackson:
    serialization:
     FAIL_ON_EMPTY_BEANS: false

同理在properties中设置为:

spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false

这里搜索到的很多说将bean中属性为private,改为public ,我没有试过也不建议这么做.

猜你喜欢

转载自www.cnblogs.com/charlypage/p/9574452.html