当前位置:网站首页>Autowired注解用于List时的现象解析
Autowired注解用于List时的现象解析
2022-07-06 23:17:00 【kgduu】
1、现象
在一个处理链中,有多个AbstractHandler,一个是管理处理链的集合CompositeHandler。Handler1,Handler2, CompositeHandler是AbstractHandler的实现类。其中CompositeHandler实现为
@Component
@Slf4j
public class CompositeHandler extends AbstractHandler {
@Autowired
private List<AbstractHandler> handlers;
@Override
public int handlerOrder() {
// TODO Auto-generated method stub
return 0;
}
@PostConstruct
public void init() {
log.info("handlers:{}", handlers);
}
日志输出handlers只有2个,分别是Handler1, Handler2。为什么会是这种现象呢?
2、分析
DefaultListableBeanFactory在解析依赖List时,获取满足指定类型的候选beanNames,会过滤与当前beanName相等的。
边栏推荐
- 【最佳网页宽度及其实现】「建议收藏」
- Thread和Runnable创建线程的方式对比
- 2039: [蓝桥杯2022初赛] 李白打酒加强版 (动态规划)
- 基于Bevy游戏引擎和FPGA的双人游戏
- 【愚公系列】2022年7月 Go教学课程 005-变量
- 带你遨游银河系的 10 种分布式数据库
- Salesforce 容器化 ISV 场景下的软件供应链安全落地实践
- Appium practice | make the test faster, more stable and more reliable (I): slice test
- Dbsync adds support for mongodb and ES
- SQL injection HTTP header injection
猜你喜欢
随机推荐
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
指针与数组在函数中输入实现逆序输出
c语言神经网络基本代码大全及其含义
Longest non descent subsequence (LIS) (dynamic programming)
【愚公系列】2022年7月 Go教学课程 005-变量
Ansible overview and module explanation (you just passed today, but yesterday came to your face)
NiO related knowledge points (I)
DBSync新增对MongoDB、ES的支持
Is PMP really useful?
Array initialization of local variables
3. Type of fund
JS variable case output user name
Clickhouse (03) how to install and deploy Clickhouse
带你遨游银河系的 10 种分布式数据库
Test interview | how much can you answer the real test interview question of an Internet company?
[ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
C语言中函数指针与指针函数
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
Full link voltage test: the dispute between shadow database and shadow table
U++ game learning notes