spring destroy bean manually instead of ctx.close()
问题 is it possible to tell the container of spring to destroy a specific bean (prototype) in order to save up memory? I dont want to user ctx.close() in order to see this bean destroyed, but rather on runtime. 回答1: If I understand you correctly you want to remove bean that was defined in the ctx at runtime, will I use BeanDefinitionRegistry to get this done, BeanDefinitionRegistry has a method of removeBean() which takes the bean name as the parameter. BeanDefinitionRegistry factory =