java - Jackson POJOPropertyBuilder finds multiple setters in POJO -
We work on a large large JSON REST API using Spring Web MVC 3.2.2 and Jackson Database 2.4.4 Are there. Many other lbs ...).
I'm trying to use, but I'm having trouble with some of our DTOs.
No matter if I code a simple <>
java.lang.IllegalArgumentException: Anti-setter definitions for each "old": javax @EnableSwagger or a more complicated strut config, I always com.fasterxml.jackson the following exceptions found when starting Tomcat 7 .xml.datatype.XMLGregorianCalendar # setyear (1 parameter) vs. javax.xml.datatype.XMLGregorianCalendar # setyear (1 parameter). Databind.introspect.POJOPropertyBuilder.getSetter (POJOPropertyBuilder.java.303) com. mangofactory.swagger.models.Annotations.findPropertyAnnotation (Annotations.java:33) on com.mangofactory.swagger.models.property.bean.BeanModelProperty. & Lt; Init & gt; (BeanModelProperty.java:26) (.property.bean.BeanModelPr opertyProvider.beanModelProperty (BeanModelPropertyProvider.java:166) on com.mangofactory.swagger.models ... the rest of the stacktrace) As the above mentioned property "year" is only an example, the year tried to do the same without containing the class property
The strange thing is that Jackson is getting the exact exact methods / setter twice. The javax.xml.datatype.XMLGregorianCalendar # setYear (1 parameter) vs. javax.xml.datatype.XMLGregorianCalendar # setYear (1 parameters
I Debugger Some of the time spent together and saw that some DTOs setters have been successful in checking for the conflict.
I have spent many hours on this now and can not come up with a solution. Most pages, which I meet with Google about overloaded methods / sets, which are not in my DTO case - they There are certain things, which are nothing more than the properties, the setters and the gates.
Any help greatly appreciated!
The problem is that XMLGregorianCalendar is set to methods: set year (int year) and set year (Bigdikaml year) . you need to do something wrong to ignore any of them, you can use the password (something like) only XMLGregorianCalendar of Con Figure can. This will work if XMLGregorianCalendar is used only in reference to return values.
If it is not, you can set the replacement type using directModelSubstitute . When you configure you can try SwaggerSpringMvcPlugin one of the options below.
< Code> @ Bean Public SwaggerSpringMvcPlugin your plugin () {... plugin.directModelSubstitute (XMLGregorianCalendar.class, String.class) // or, how it is intended to use and how you want to // serialized / deserialized type swagger UI To appear on plugin.directModelSubstitute (XMLGregorianCalendar.class, Date.class) ... return plugin} or if you display in your API document The do not care about the type, you can.
Comments
Post a Comment