Hi Henning,

Dropwizard per se doesn't dictate the use of any specific DI framework (such as 
CDI, Spring DI, HK2, or Guice).

Incidentally, Jersey is using HK2 under the hood but Dropwizard currently 
doesn't expose this explicitly.

If you want to use HK2 in your application, you can do so quite easily: 
https://gist.github.com/joschi/f706e394172988f9200b 
<https://gist.github.com/joschi/f706e394172988f9200b>


Cheers,
Jochen

> Am 05.10.2016 um 16:18 schrieb Henning Verbeek <[email protected]>:
> 
> I've spent the last months manually creating RESTful backends based on 
> Jersey/Jackson/etc and am now testing out Dropwizard for a new project. While 
> this is my first week in DW, I feel right at home.
> 
> The one thing that strikes me as odd though is the lack of CDI. Everything is 
> wired through constructors. Since Jersey is using HK2 at its core, how come 
> this is not used more?
> 
> As an example: in http://www.dropwizard.io/1.0.2/docs/manual/hibernate.html, 
> an instance of UserDAO is created with the hibernate-sessionfactory and 
> passed to the constructor of the UserResource. Why is this not turned around: 
> UserResource requests injection of UserDAO; UserDAO requests injection of the 
> sessionFactory.
> 
> I must be missing something here...
> 
> Thanks for your insights.
> Henning

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to