dropwizard-guicier icon indicating copy to clipboard operation
dropwizard-guicier copied to clipboard

@BeanParam Values not being populated

Open jcampos8782 opened this issue 8 years ago • 10 comments

I have a GET resource that accepts a @BeanParamobject with two @QueryParam strings. The bean object appears to be being instantiated by Guice and hydration of the query parameters is not occurring.

In the same project, I have a POST resource that accepts an object which uses @JsonProperty to populate the values. That appears to be working as expected (the JSON us being serialized in to the object properly).

jcampos8782 avatar Aug 24 '16 03:08 jcampos8782

Pushed an example project https://github.com/jcampos8782/broken-beans Confirmed that this is not reproducible without the GuiceBundle.

jcampos8782 avatar Aug 24 '16 04:08 jcampos8782

I can confirm this bug, did a little research a few days ago and found these issues: https://java.net/jira/browse/HK2-300 https://java.net/jira/browse/JERSEY-3119

With rolling back to dw v0.9.3 and guicier v0.9.1.0 you get it working again.

reysy avatar Aug 24 '16 09:08 reysy

Is there a ETA for the next release of DropWizard with Jersey 2.23.2 & HK2 2.5.0-b06 , which claimed to have the fix?

sachin-r avatar Oct 27 '16 17:10 sachin-r

My guess is that the issue is not related to "droopwizard-guicer" only, as far as it's observed for "dropwizard-guice" too: https://github.com/HubSpot/dropwizard-guice/issues/93 I also have created a project to demonstrate it: https://github.com/medvedev/beanparam-jersey-guice This comment explains the details of issue: https://github.com/HubSpot/dropwizard-guice/issues/93#issuecomment-251767171

Update: With jersey 2.25 and hk 2.5.0-b30 @BeanParam values are still not populated, as shown in my demo project.

medvedev avatar Jan 05 '17 09:01 medvedev

Any idea when a new version might be released with a fix for this issue? I am encountering this in my project, where using the BeanParam annotation in association with QueryParams results in a empty object.

I am using DropWizard v1.0.5 and DropWizard Guicier v1.0.0.6.

johngifford avatar Apr 20 '17 17:04 johngifford

Downgrading hk2-locator and hk2-api to 2.4.0-b31 works (the version used by the latest dropwizard-guicier where this still works). 2.4.0-b33 also works. So 2.4.0-b34 broke it. I'm looking at the differences with https://github.com/javaee/hk2/compare/2.4.0-b33...2.4.0-b34 ... Trying to find something. It links to https://java.net/jira/browse/HK2-170 which is a dead link. Anyone that can help me find the original jira? @ljnelson maybe you can help?

When it works, it's because there's a descriptor found in hk2 so the BeanParam object is created by hk2. When it's not working there's no descriptor found in hk2 and it falls back to try to create it with guice.

jontejj avatar Aug 04 '17 13:08 jontejj

Was this fixed? Is there an "official" fix? I'm quite puzzled about what to do with this issue to keep it future proof.

OndraZizka avatar Jun 06 '18 11:06 OndraZizka

This is still broken for me in guicier 1.0.0.6

edlerd avatar Jun 08 '18 08:06 edlerd

Hello Guys, any updates on this?

asakalou-exadel avatar Dec 18 '19 11:12 asakalou-exadel

I gave up on this a long while ago and ditched it for the much more flexible https://www.ninjaframework.org/

jcampos8782 avatar Dec 24 '19 04:12 jcampos8782