spring移除容器bean
public void removeBeans(List<String> beans) { ConfigurableApplicationContext context = (ConfigurableApplicationContext) applicationContext; if (context == null) { return; } DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) context.getBeanFactory(); for (String bean : beans) { beanFactory.removeBeanDefinition(bean); } }