spring
@Autowired, @Primary, and @Qualifier.
Collision Handling:
When multiple beans of the same type exist and you try to @Autowired one, Spring will throw a NoUniqueBeanDefinitionException.
Solutions:
- @Primary: Marks one bean as the default choice.
- @Qualifier("name"): Explicitly specifies which bean to inject by its ID/Name.
- Naming Convention: If you name your variable the same as the bean ID, Spring uses that to resolve the dependency (less reliable than Qualifiers).