关闭spring boot jackson的FAIL_ON_EMPTY_BEANS

异常

org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: No serializer found for class com.google.common.cache.CacheStats and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

解决

    @Bean
    public ObjectMapper objectMapper() {
        return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    }

你可能感兴趣的:(springboot)