Reputation: 20319
I'm getting started with Helidon MP and for the most part its pretty sweet. I'm not a huge fan of the CDI system as I have extensive experience with Guice in past projects.
I've been trying to figure out how to re-wire dependency injection for Helidon MP to use something like Guice or Dagger2 but I cannot find anything online that documents how you would do this.
Is this even possible? Or do I switch to Helidon SE and wire it all up myself?
Upvotes: 0
Views: 392
Reputation: 1
If you're really attached to Guice, you can use code generators like avaje-http to create JSR-330-compatible helidon SE router classes from a JAX-style controller class. This'll help reduce the friction with using SE, but you'll need to wire everything not helidon SE related though.
Upvotes: 0
Reputation: 16238
Yes, but MicroProfile requires the presence of CDI, so as long as you continue to use a MicroProfile implementation (such as Helidon MP) CDI must be in the picture. Might be better to just embrace it rather than shipping an application or a library with several dependency injection frameworks of which only one will be active.
Upvotes: 2
Reputation: 710
After Helidon 4 release, there will be an option for Helidon's own dependency injection framework, which is compile–time and JSR-330 compatible. It is a work in progress now.
Upvotes: 2
Reputation: 7634
Helidon MP offers CDI through Weld. I am not aware of Helidon supporting anything other than Weld for CDI. If for some reason you require Guice, look at DropWizard or other alternatives.
An alternative would be to use Helidon SE to wire up Guice support yourself, but you have to ask yourself if it is worth all that effort and maintenance.
Upvotes: 1