-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Full support for Jackson 2.7 [SPR-13483] #18062
Comments
Sébastien Deleuze commented Fixed by this commit, see #18301 comments for more details. Jackson 2.7 and our support for it contains significant changes related to type resolution, so the more testing and feedbacks we get before GA, the best it is (for example in Spring Data cc Oliver Drotbohm). |
Osvaldo Pinali Doederlein commented Since you asked for more feedback :) I just tried Spring 4.2.3 + Jackson 2.7.1 (which was just released promising some relief for this, see FasterXML/jackson-databind#1079). It still didn't work for me, but now with more interesting test failures like:
The exception is raised in my app code, but investigating this, it turns out the problem is related to resolution of methods with generics. The update() method at the top of stack has a parameter typed as UserResource, which is overriding a superclass's method definition where this parameter is a <C extends ExternalResource>, so the typecast is performed by a javac-generated stub (thus line "1" in the stack). Now the question becomes, why does the argument have the incorrect type. I have traced this to InvocableHandlerMethod.getMethodArgumentValues(); it's trying to work with a bean where I have this:
Generics once again -- the above is in a base class, the actual bean is a derived UserController class that makes T->UserResource. The InvocableHandlerMethod looks wrong, it has: The derived class UserController does NOT override this method, it doesn't even have any stub either. The only way to detect that this parameter must be an UserResource is by inspecting the bean class with getGenericSuperclass(), so you know that it binds its parameter #0 to UserResource, which with some effort can be correlated to the method definition in the superclass. But the good news is that the fix you have for 4.3.0 makes even this scenario works; the tests passes again with the current 4.3.0 snapshot (doesn't pass with the 4.2.5 snapshot). |
Sébastien Deleuze commented Thanks for your feedback, and glad it works with 4.3.x. Indeed unlike Jackson 2.7.0, Jackson 2.7.1 avoid to break totally your app with Spring 4.2.x but given the changes they did, it is expected that generic resolution still does not work anymore. That's in line with the fact that Spring 4.2.x does not support Jackson 2.7.x (and won't from my POV since my fix would be a risk for regressions). |
Juergen Hoeller commented Agreed from my side: Proper Jackson 2.7 support will have to remain a Spring 4.3 topic, going through the RC phase there, with Spring 4.2.x just fully supporting Jackson up until 2.6.x. Spring Framework 4.3 RC1 is less than two months away anyway... Juergen |
Suhas V. Wadadekar commented After upgrading to Jackson 2.7.5 and Spring 4.3.0.RELEASE, I get the following error when using Jackson to transform response body to JSON
It doesn't help if I rollback Jackson to 2.6.7. However, if I downgrade Spring to 4.2.6, then the problem goes away (both with Jackson 2.6.7 and 2.7.5) (I understand, that while official support for Jackson 2.7+ was only added in Spring 4.3, using Spring 4.2.6 with Jackson 2.7.5 may not be the best idea, even if it seems to work fine for me, as there could be bugs lurking somewhere). Anyways, it seems like Spring 4.3 has some issues with Jackson overall. |
Juergen Hoeller commented That So it actually looks like there's some old pre-2.5 Jackson jar lurking on your classpath, maybe brought in transitively through some other Maven dependency of yours... Could you please double-check that Jackson 2.6 or 2.7 is exclusively present? |
Juergen Hoeller commented BTW, as of Spring 4.3, we also support Jackson 2.8 (currently in RC2) already. This is what we run against in our own test suite at the moment. |
Suhas V. Wadadekar commented Thanks for your comment. Now, I am using Wildfly 8.2.1 and has jackson modules installed with version 2.4.1. I am not using those, but I will see if that might an issue. |
Juergen Hoeller commented It looks like that WildFly-included version of Jackson gets picked at runtime then. In other words, it might not matter which version you package into your war file since the WildFly-included version always gets picked up first... With Spring 4.2.x, you wouldn't have noticed, but as of Spring 4.3, we require Jackson 2.6+... |
Suhas V. Wadadekar commented Yep, that was it. Thanks again for the pointers. |
Juergen Hoeller opened SPR-13483 and commented
Work on Jackson 2.7 started in August 2015 and completed in early January 2016. We need to revise our type variable exposure (#18301) for proper Jackson 2.7 support in Spring Framework 4.3 and should also evaluate other changes that are worth adapting to.
Issue Links:
Referenced from: commits a730e55
1 votes, 7 watchers
The text was updated successfully, but these errors were encountered: