Henning:

 early versions of Dropwizard made heavy use of Guice to dependency
inject…just about everything. In our (Yammer's) experience, DI got in the
way more often than not (complicating debugging) and our services were tiny
and didn't really benefit much from DI, so it was removed in favor of
explicitly passing objects.

As Jochen pointed out, you can use HK2 if you'd like. Others have
re-integrated Guice as a module (I don't have a link offhand).

Ryan

On Wed, Oct 5, 2016 at 7:18 AM, Henning Verbeek <[email protected]>
wrote:

> 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.
>

-- 
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