@Autowired
ApplicationContext ctx;
pubic void registerBean(String name,Object obj){
DefaultListableBeanFactory beanFactory=(DefaultListableBeanFactory)ctx.getAutowireCapableBeanFactory();
beanFactory.registerSingleton(name,obj);
}
@Autowired
ApplicationContext ctx;
pubic void registerBean(String name,Object obj){
DefaultListableBeanFactory beanFactory=(DefaultListableBeanFactory)ctx.getAutowireCapableBeanFactory();
beanFactory.registerSingleton(name,obj);
}
转载于:https://my.oschina.net/u/2413863/blog/1540698