Reputation: 95
Is it possible to use dependency inject with the Tyrus Standalone Server?
Upvotes: 1
Views: 415
Reputation: 5324
It is possible, but you will need to do little extra work to enable that.
Currently, Tyrus does not have any example which would demonstrate it, but there is simple mechanism, which allows you to register custom ComponentProvider.
If you add/register your own with the code which will get an instance from CDI container, it should effectively enable CDI. There will be some limitations (@Inject to method params most likely won't work properly, @Inject to fields should be fine), but you have at least something to start with.
BTW, if you manage to do that in shareable manner, feel free to contribute it back (as an example) to Tyrus: [Project Tyrus - Contribute]
Upvotes: 2