Skip to content

sowieso-fruehling/spring-bean-injection-techniques

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Examples of different techniques for choosing spring bean to be injected

When we have more beans implementing the same interface and we use interface type as the bean type while injecting it, spring will throw NoUniqueBeanDefinitionException if we don't uniquely define which implementation of that interface should be used

Presented techniques are:

 Compile time:
    - bean name based
    - Usage of @Qualifier annotation
    - Custom qualifier usage
    - Usage of @Primary annotation
    
 runtime:
    - Usage of @Profile annotation (and it's combination with @Primary)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages