该方法一共核心文件包括4个类,下面4个类时具体的使用方式,下面来逐一讲解
1、工厂的核心方法(BaseFactory)
public class BaseFactory<T extends FactoryService<?>> implements InitializingBean, ApplicationContextAware {
private ApplicationContext applicationContext;
private Map<FactoryType, T> factoryMap = new HashMap<>();
@Override
public void afterPropertiesSet() throws Exception {
Type genericSuperClass = this.getClass().getGenericSuperclass();
if (!(genericSuperClass instanceof ParameterizedType)) {
throw new RuntimeException("类型不对");
}
Type[] args = ((ParameterizedType