|
From: Chistophe V. <spr...@pa...> - 2004-07-08 09:26:29
|
On Thursday 08 July 2004 11:12, Mason, Ross wrote: > Hi, > I create a lot of different types of object in an applicationContext, all > of which have a name property i.e. > > <bean id="jmsConnector" className="org.mule.providers.jms.JmsConnector"> > <property name="name"><value>jmsConnector</value></property> > </bean> > > I don't like having to include the name property if there is a chance I > could use the bean id instead. Is there any way I can uniformly intercept > bean creation in the context so that straight after the constructor is > called I can get hold of the bean id and set it on my object? > > I can't wait until the applicationContext is configured and then set the > names as some objects have a collection of other objects which are keyed > against the name. > You could implement BeanNameAware: <http://www.springframework.org/docs/api/org/springframework/beans/factory/BeanNameAware.html> -- Kind regards, Christophe Vanfleteren |