Skip to content

InvalidDefinitionException: "Argument #0 of constructor has no property name" #170

Closed Answered by cowtowncoder
NadChel asked this question in Q&A
Discussion options

You must be logged in to vote

It means that unless you have registered module jackson-module-parameter-names (see https://github.com/FasterXML/jackson-modules-java8/), names of Constructor arguments are not detected. This separation is due to historical reasons as functionality only became available on Java 8 and Jackson used to work on earlier JDKs as well.
Without this module, you would need to add @JsonProperty next to constructor argument names: #0 refers to the first one (arguments are 0-indexed).

So: you want to make sure to include jackson-module-parameter-names as per README at https://github.com/FasterXML/jackson-modules-java8/ (need a Maven / Gradle dependency to get it; then use registerModule or addModule).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NadChel
Comment options

Answer selected by NadChel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants