javabeans - spring destroy bean manually instead of ctx.close() -


is possible tell container of spring destroy specific bean (prototype) in order save memory?

i dont want user ctx.close() in order see bean destroyed, rather on runtime.

if understand correctly want remove bean defined in ctx @ runtime, use beandefinitionregistry done, beandefinitionregistry has method of removebean() takes bean name parameter.

beandefinitionregistry factory =     (beandefinitionregistry) applicationctx.getautowirecapablebeanfactory(); 

then

((defaultlistablebeanfactory) beanfactory).destroysingleton("mybean"); 

edit

reference http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/beans/factory/support/beandefinitionregistry.html#removebeandefinition%28java.lang.string%29


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -