@Bean
public CompactDisc sgtPeppers(){
return new SgtPeppers();
}
@Bean
public CompactDisc hardDaysNight(){
return new HardDaysNight();
}
@Bean
public CDPlayer cdPlayer(CompactDisc compactDisc){
return new CDPlayer(compactDisc);
}
能通过什么注解指定注入的类么?
Can be accessed via
@Bean(name = "beanName")
指定 Bean 的 name;然后在参数前添加@Qualifier("beanName")