-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jackson doesn't follow JavaBean naming convention #653
Comments
Thanks! I'll have to discuss this briefly on mailing lists, just because it is a backwards-incompatible change. |
Ok, ended up adding: |
A little known part of the been spec, since a getter/setter with a capital letter in second position indicates that the first char is also a capital. If the first char is in fact not a capital, then it needs to be lowercase in the getter/setter also. See also: * https://stackoverflow.com/questions/8969112/confused-about-naming-of-javabean-properties-with-respect-to-getters-and-setter * FasterXML/jackson-databind#653 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=322223 Fixes #756
JavaBeans spec:
getUrl/setUrl => property name: url
getURL/setURL => property name: URL
Jackson:
getUrl/setUrl => property name: url
getURL/setURL => property name: url
JavaBeans(TM) Specification 1.01 Final Release
8.8 Capitalization of inferred names.
http://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/
Introspector.decapitalize
http://docs.oracle.com/javase/8/docs/api/java/beans/Introspector.html#decapitalize-java.lang.String-
Background:
Ajax post data: URL=example.com
(Content-Type: application/x-www-form-urlencoded)
+
POJO: getURL/setURL
+
Spring MVC
=> HTTP 200 OK
Ajax post data: {"URL":"example.com"}
(Content-Type: application/json)
+
POJO: getURL/setURL
+
Spring MVC @RequestBody (Jackson Integration)
=> HTTP 400 Bad Request
The text was updated successfully, but these errors were encountered: