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
敞开该查问的懒加载 fetchType="eager"
上面的两种办法我也试过,如同并没有什么作用,在进行序列化的时候就会呈现问题比如说BackstageRole会变成Backstage_$$_jvst12a_0这种代理对象(非原始对象)。
<resultMap id="RoleMap" type="com.hyper.netman.entity.business.BackstageRole"> <result column="id" property="id"/> <result column="role_name" property="roleName"/> <result column="role_desc" property="roleDesc"/> <result column="create_time" property="createTime"/> <result column="modify_time" property="modifyTime"/> <!--须要敞开懒加载,不然对象不是原来的对象--> <collection property="resources" column="id" javaType="list" fetchType="eager" select="getRolesMenus"/></resultMap>
- 返回的类加上注解(即实体类)
@JsonIgnoreProperties(value = { "handler" })public class BackstageRole{}