spring-native
spring-native copied to clipboard
Add support for Jackson JsonNaming strategies
When using a naming strategy with version 0.10.2
, a @TypeHint
has to be added manually.
Otherwise on startup this exception is thrown:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
Class com.fasterxml.jackson.databind.PropertyNamingStrategies$SnakeCaseStrategy has no default (no arg) constructor
example bean
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
class SomeBean { ... }
Maybe the strategies could be included selectively using JsonNaming
as trigger in org.springframework.boot.autoconfigure.jackson.JacksonHints
.
Still a problem with 0.12.0. Workaround is:
@NativeHint(
types = { @TypeHint(types = PropertyNamingStrategies.SnakeCaseStrategy.class, access = TypeAccess.PUBLIC_CONSTRUCTORS) }
)
Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.
As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the related Spring project (Spring Framework, Data, Security, Boot, Cloud, etc.) with a reproducer.
Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.