Lets assume you have the following Classes extending the Processor interface:
Interface Processor {}
class ProcesorImpl1 implements Processor {}
class ProcesorImpl2 implements Processor {}
Now, Lets assume that you define the following bean in a configuration class in package1:
class ConfigurationClass1 {
@Bean
@Qualifier("processor")
public Processor processor() {
return new ProcesorImpl1();
}
}
Next, you define the following bean in a configuration class in package2:
class ConfigurationClass2 {
@Bean
@Qualifier("processor")
public Processor anotherProcessor() {
return new ProcesorImpl2();
}
}
The question is how does Spring resolves the following Injection:
@Inject @Qualifier("processor") proc;
What if one of the Beans are annotated with @Primary?