import demo.toster.BeanA;
import demo.toster.BeanB;
import demo.toster.IBean;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class Config {
@Bean
public IBean beanA() {
return new BeanA();
}
@Bean
public IBean beanB() {
return new BeanB();
}
@Bean
public AbstractService serviceA(@Qualifier("beanA") IBean bean) {
final ServiceImpl service = new ServiceImpl();
service.setBean(bean);
return service;
}
@Bean
public AbstractService serviceB(@Qualifier("beanB") IBean bean) {
final ServiceImpl service = new ServiceImpl();
service.setBean(bean);
return service;
}
}