Currently, new Java 14 record types cause json serializer for spring boot http end points throw obscure errors like below.

These issues have to do with FasterXML/jackson library used by spring web/boot for json serialization, but I just wanted to mention it here for anyone interested:

No converter found for return value of type: class xxxx org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: xxxx
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:230)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:181)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
...
````

the reason it seems like that jackson library currently doesn't natively support java 14 types.
https://github.com/FasterXML/jackson-future-ideas/issues/46

a simple work around is to add 

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) ``` to the record type which seems to address the issue.

related FasterXML issue is https://github.com/FasterXML/jackson-future-ideas/issues/46

Comment From: wilkinsona

Thanks for letting us know. We'll upgrade to a version of Jackson with record support in due course.

Comment From: rajadilipkolli

@wilkinsona , Can we add a note in documentation that if we need to use Records, use workaround till fasterXML supports automatically.

Comment From: wilkinsona

Thanks for the suggestion, but I don't think we should do that. I don't think Spring Boot's documentation is the right place to note whether a third-party library supports certain Java features. The libraries' own documentation is a better place for it.

Comment From: ijrodrigues

You also can create a @Configuration to apply this setting to all records (avoiding annotating each one)

```import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; import static com.fasterxml.jackson.annotation.PropertyAccessor.FIELD;

@Configuration public class JsonSerializerConfig {

@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
    return builder -> builder.visibility(FIELD, ANY);
}

}