[jboss-user] [JBoss/Spring Integration] - Re: Bean destroy methods when undeploying

alesj do-not-reply at jboss.com
Tue Jul 15 16:35:27 EDT 2008

"tkyung" wrote : Is there a downside for making this a prototype bean?
This is more of a Spring question, so you should really ask there.
But I think this is what happens here is that if a bean is prototype, Spring doesn't track it anymore, so nothing happens on shutdown - since it's out of Spring's scope.

What you should really use is, SpringDeployer's hierarchy notion:
 - http://java.sys-con.com/read/180386.htm
anonymous wrote : 
  |  Since we'd like to hot deploy many different Spring archives, each of them must be uniquely represented in our environment. For that purpose, JNDI will be used as a registry for these deployments. But where can we get our local JNDI name? By default, this JNDI name is obtained from the archive's file name: .spring or -spring.xml. But since it's also possible for each bean factory to have parent bean factory, there should be a way to define this parent's name too. This can be done in Spring's beans xml descriptor in description tag as shown in Listing 3.
  | We are parsing this description tag and looking for a regular expression pattern of 'BeanFactory=()' and 'ParentBeanFactory=()' so see Listing 4.
  | Every time a Spring component is undeployed, we get the corresponding Bean factory through the URL string key in our bean factory map. We remove the map entry, destroy the bean factory singletons, and unbind it from JNDI. When undeploying components be careful of the bean factory hierarchy; don't undeploy some other component's parent bean factory. When shutting down, JBossAS undeploys components in reverse order, which is the right behavior for our child-parent bean factory hierarchy.

And then you can access other context's bean directly.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164598#4164598

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164598

More information about the jboss-user mailing list