I have two Spring Configuration classes defined as follows
@Configuration
public class ClsA {
@Bean
@Qualifier("ClasA")
public String getSomething(){
return "somethingA";
}
}
@Configuration
public class ClsB {
@Bean
@Qualifier("ClsB")
public String getSomething(){
return "somethingB";
}
}
Both have the same method name. Even though qualifiers are different, the application doesn't load as it only injects one and wherever the other one is injected, if fails with noBeanDefinition exception let's say for ClsB bean qualifier.
When I keep the method name different and everything loads hunky dory.
Is this behavior normal ? Why doesn't spring load these beans just fine as they have different qualifiers ?