Spring Bean

 

1.根据类型获取所有Bean getBeansOfType、getBeanNamesForType

//key位 beanName,value为bean
Map<String, Interface> result = SpringBeanUtil.getApplicationContext().getBeansOfType(Interface.class);
//返回 beanName 的String 数组
String[] result = SpringBeanUtil.getApplicationContext().getBeanNamesForType(Interface.class);
posted @ 2020-09-04 08:37  ~风铃~  阅读(120)  评论(0编辑  收藏  举报