一篇文章告诉你spring中的@Autowired注入时到底是根据byType还是byName
先写几个栗子观察运行结果
配置类
@Configuration
@ComponentScan("test")
public class AppConfig {
}
接口类
public interface Hunter {
public void display();
}
两个实现类
@Component
public class Hunter1 implements Hunter {...
原创
2019-01-08 11:33:38 ·
8598 阅读 ·
3 评论