|
From: Dmitriy K. <dko...@ru...> - 2004-07-08 15:26:28
|
Ross, can you please attach this BPP and the corresponding appCtx descriptor? Thanks, Dmitriy. Mason, Ross wrote: >Cheers guys. I'm using the BeanPostProcessor. > >When I try using the BeanPostProcessor on a FactoryBean I get a ClassCastException. Which at first made sense because I figured it was trying to cast my actual bean instance (not FactoryBean) to a BeanPostProcessor, but then why wouldn't it use the actual factory instance. Anyway here is the stack trace - > >java.lang.ClassCastException > at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:328) > at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:264) > at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:58) > at org.mule.extras.spring.config.SpringConfigurationBuilder.configure(SpringConfigurationBuilder.java:40) > at org.mule.tck.AbstractConfigBuilderTestCase.setUp(AbstractConfigBuilderTestCase.java:53) > at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78) > >Cheers, > >Ross > >-----Original Message----- >From: spr...@li... on behalf of jürgen höller [werk3AT] >Sent: Thu 8/07/2004 10:45 AM >To: spr...@li... >Cc: >Subject: Re: [Springframework-developer] Intercepting bean creation? > > > > I recommend BeanNameAware too, if you just want to become aware of the bean name. > > For general post-processing of a newly created bean instance, you could define a BeanPostProcessor in the context, which will automatically intercept all beans that this context creates: > > http://www.springframework.org/docs/api/org/springframework/beans/factory/config/BeanPostProcessor.html > > Juergen > > > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...]On Behalf > Of Chistophe Vanfleteren > Sent: Thursday, July 08, 2004 11:26 AM > To: spr...@li... > Subject: Re: [Springframework-developer] Intercepting bean creation? > > > 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 > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > |