//之前都是直接newInstance的到obj,类中的变量无法被注入
//Object obj = aClass.newInstance();
//改成如下方式的到bean,变量就能顺利被注入 ,其他不变
@Autowired
private ApplicationContext context;
Object bean = context.getAutowireCapableBeanFactory() .createBean(aClass, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);