当前位置:网站首页>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相等的。


边栏推荐
猜你喜欢

Inventory host list in ansible (I wish you countless flowers and romance)

Mysql database (basic)

U++ game learning notes

高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍

ThinkPHP关联预载入with

U++4 接口 学习笔记

If you‘re running pod install manually, make sure flutter pub get is executed first.

U++4 interface learning notes

U++ metadata specifier learning notes

When knative meets webassembly
随机推荐
接口间调用为什么要用json、fastjson怎么赋值的、fastjson [email protected]映射关系问题
高数中值定理总结
npm ERR! 400 Bad Request - PUT xxx - “devDependencies“ dep “xx“ is not a valid dependency name
【问道】编译原理
Function pointer and pointer function in C language
Markdown editor
Timer创建定时器
【QT】自定义控件-Loading
【最佳网页宽度及其实现】「建议收藏」
Ansible reports an error: "MSG": "invalid/incorrect password: permission denied, please try again“
使用知云阅读器翻译统计遗传学书籍
一文搞懂常见的网络I/O模型
Leetcode(417)——太平洋大西洋水流问题
Inventory host list in ansible (I wish you countless flowers and romance)
CentOS 7.9安装Oracle 21c历险记
Servicemesh mainly solves three pain points
If you‘re running pod install manually, make sure flutter pub get is executed first.
ASP. Net MVC - resource cannot be found error - asp Net MVC – Resource Cannot be found error
Thread和Runnable创建线程的方式对比
File upload vulnerability summary