XXX implements implements InitializingBean{

@Override
public void afterPropertiesSet() throws Exception {

private static Map<String, Interf> nameAndSubClassMap = new HashMap<>();

/**
 * getBeansOfType 获取bean(包括其子类实例)
 */
Map<String, Interf> machineMap = SpringContextUtil.getApplicationContext().getBeansOfType(Interf.class);
machineMap.values().forEach(iInterf -> {
    stateMachineMap.put(iInterf.getClassName, iInterf);
});

}


丰木
322 声望19 粉丝

遇见超乎想象的自己!