环境:Spring Boot 2 + Hibernate 4.3+JPA
方法:JPA中的findOne(),
问题:
Postman请求,抛出如下错误
HTTP Status 500 - Could not write JSON: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.SerializationFeature.FAIL_ON_EMPTY_BEANS) )
解决方案:
配置文件中加上:
spring.jackson.serialization.fail-on-empty-beans=false