Skip to content
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

Detect beans when @Inject is present [SPR-9835] #14468

spring-issuemaster opened this issue Sep 27, 2012 · 1 comment


None yet
2 participants
Copy link

commented Sep 27, 2012

Thomas Oellrich opened SPR-9835 and commented

I recently had a look at a new Dependency Injection framework called Dagger from Jesse Wilson at Square.

It has two cool features that I wish Spring had as well (will create a separate issue for the other feature). Dagger adds beans automatically to the application context (called ObjectGraph in Dagger) when a field or constructor is annotated with @Inject (Dagger doesn't support method injection). This means the bean itself doesn't need to be annotated at all. All the alternatives for this in Spring are not very appealing:

(a) Using @Component leads to a dependency on the Spring API
(b) Using @Named (without name) isn't very descriptive at all
(c) Using @ManagedBean is awkward when not using JSF and requires one to add another dependency since it's not part of the JDK

In short, it would be great if no annotation would be required.

Affects: 3.1.2

Issue Links:

  • #14469 Injection of beans that implement interfaces with Generics without qualifier annotation

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 28, 2018

Sébastien Deleuze commented

I think that can be achieve by declaring beans with @Bean in conjunction with Spring ability to automatically autowire classes with a single constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.