HubSpot / dropwizard-guice

Adds support for Guice to Dropwizard
Apache License 2.0
266 stars 95 forks source link

AutoConfig not honouring Guice Singleton annotation on resource classes #96

Open pratikkumar19 opened 8 years ago

pratikkumar19 commented 8 years ago

Whenever a Jersey resource class is annotated with @Singleton (guice annotation) hk2 doesnot honour it as it searches java's @Singleton annotation. This is solved by using java's Singleton annotation but without a proper warning or documentation provided this issue might go unsolved.

In my case this resulted in in-memory caches being intialised for every request as hk2 doesnot honour Guice annotation. Atleast a fair warning in javadocs or github documentation might help the developer.

PeterWippermann commented 6 years ago
  1. Could you please extend your issue description by the fully-qualified names of the Singleton annoations you refer to?
  2. This is a library to glue Dropwizard and Guice. Why should it keep HK2 (which is an alternative to Guice) in mind?