Skip to content
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

Closed
slopetown opened this issue Dec 16, 2014 · 2 comments
Closed

Jackson doesn't follow JavaBean naming convention #653

slopetown opened this issue Dec 16, 2014 · 2 comments
Milestone

Comments

@slopetown
Copy link

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

@cowtowncoder
Copy link
Member

Thanks!

I'll have to discuss this briefly on mailing lists, just because it is a backwards-incompatible change.
But I think it would make sense to be compliant with Bean name-mangling scheme.
So at most we may need to introduce a feature, to allow using existing scheme if needed to support legacy code.

@cowtowncoder cowtowncoder added this to the 2.5.0 milestone Dec 19, 2014
@cowtowncoder
Copy link
Member

Ok, ended up adding: MapperFeature.USE_STD_BEAN_NAMING (defaults to false) -- enable this feature and naming should follow standard JDK Bean convention (identical to BeanIntrospector.decapitalize()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants