New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for injection via @Resource annotation #45
Comments
This is a good idea. I'll look into this and add it if I can. |
Have a look at Randgalt@ee385df and see if it will meet your needs. |
Jordan, unfortunately this commit doesn't help to my situation. I have this exception: Caused by: javax.naming.NameNotFoundException: No resource found that matches: com.netflix.governator.lifecycle.LifecycleManager$1@13e573 For my understanding of JSR-250 - that @resource annotation allows you to inject anything like with regular @Inject annotation and there is no mandatory need to explicitly bind this injected resources. Many 3rd party frameworks assumes that with @resource they will get dependencies - for example take a look at: Also i have attached my junit test for this situation: |
OK - I added a default ResourceLocator that looks-up via the Guice Injector. Your test now pass and have been included in the Governator code. This change will be released soon. |
Please add support for injection via @resource annotation:
@resource
public void setResource(Jsr250Resource resource) {
this.resource = resource;
}
With this feature Governator will be fully JSR-250 compliant and can fully replace old Mycila-Guice project.
You can see implementation example in Mycila-Guice project:
com.mycila.inject.jsr250.Jsr250KeyProvider
I've tried to combine Mycila-Guice and Governator with:
injector = LifecycleInjector.builder().withBootstrapModule(new BootstrapModule() {
@OverRide
public void configure(BootstrapBinder binder) {
binder.install(Jsr250.newJsr250Module());
}
}).withModules(allModules).inStage(Stage.PRODUCTION).createInjector();
But in this case @PostConstruct methods called twice :(
The text was updated successfully, but these errors were encountered: