Overview

I am using Spring Boot 3.0 RC1 and GraalVM latest.

My native image works fine.

@JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class)

Using the above annotation for upper case JSON field names works fine with jar, but it doesn't work when running in the native image.

I am also using Lombok @Data on my POJO.

2022-10-26T14:42:15.875+02:00 WARN 1 --- [nio-8080-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Error creating bean with name 'com.fasterxml.jackson.databind.PropertyNamingStrategies$UpperSnakeCaseStrategy': Failed to instantiate [com.fasterxml.jackson.databind.PropertyNamingStrategies$UpperSnakeCaseStrategy]: No default constructor found] |

Related Issues

  • 29426

  • 29646

Comment From: sbrannen

What happens if you manually add GraalVM native image reflection configuration for com.fasterxml.jackson.databind.PropertyNamingStrategies.UpperSnakeCaseStrategy?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: snicoll

Note that we had a similar report in Spring Boot and we've just pushed something that would contribute those hints, see https://github.com/spring-projects/spring-boot/pull/33080

Comment From: sbrannen

@snicoll, it looks to me like the PR in Boot will only register those constant fields for reflection, not the constructors for the actual PropertyNamingStrategy implementations.

Or am I missing something?

Comment From: sdeleuze

Should be handled by #29646 fix.