-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
"Conflicting getter definitions" with @BeanProperty when using ScalaClassIntrospectorModule #73
Comments
No, not at time; looks like this is a bit of an oversight in my testing of the new introspection, so thanks for highlighting this use case, and I'm glad you have a workaround. In the short term, deferring to the |
This is quite a problem. A lot of scala code has java style getters and setters for java interop. Upgrade to jackson 2.2 breaks working code. And the workaround has it's limitations. In our case we use scala code - no java getters and setters. So we can't remove ScalaClassIntrospectorModule. We also use documentation in Swagger. It has (in order to work with other frameworks) java style getters as well scala fields. So we would need to remove ScalaClassIntrospectorModule. That's not easy! For example apiVersion() (from var in constructor) and getApiVersion() manually written in: |
I completely understand, this is my highest priority to fix for 2.2.1. |
I've just pushed a fix to master that should address this issue, and it will go out with Jackson 2.2.1. If there's an urgent need for a patched "2.2.0-1" for this, open another issue and I'll see what I can do. |
Thanks! |
Great! Thanks for the quick turnaround. No need for an urgent patch from my perspective. |
We have a mixed Java/Scala project where many of our domain objects are written in Scala. Because we use Hibernate for persistence, we have to annotate our properties with
@BeanProperty
. Unfortunately, when we useScalaClassIntrospectorModule
, Jackson picks up both the Scala-style getter and the Java Beans-style one.Say we have a domain class like this:
If we try to serialize a list of
Foo
s with theScalaClassIntrospectorModule
added to ourObjectMapper
, we get this:Fortunately, because of your mixin design, we can work around this by just excluding the
ScalaClassIntrospectorModule
and rely on@BeanProperty
as we are forced to elsewhere.But is there an easy way to make this configurable? Could the Scala introspector detect the presence of bean-style accessors and defer to them? (Having the Scala accessors take precedence over the bean-style ones would be fine, too---I just imagine that the other way would be easier.) Is there something I can configure in Jackson that I am missing?
Thanks!
The text was updated successfully, but these errors were encountered: