I agree with your take on this; the example cases are not really suitable for projects of greater complexity.
My own approach is to load a Spring ApplicationContext, wrap it in a Dropwizard Managed instance for graceful shutdown, and pull from that Spring context various JAX-RS resources, filters, etc., to register with Jersey within Application.run(). FWIW I chose Spring based on 1) its powerful XML configuration options, 2) integration with its expression language, and 3) a strong dislike for dependency autowiring / annotation DI. --Steve On Wednesday, October 5, 2016 at 10:18:26 AM UTC-4, Henning Verbeek 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.
