|
From: <jue...@we...> - 2003-11-20 21:23:44
|
Indeed, it did - I've removed it because bean definitions and thus the = RootBeanDefinition class are an internal implemenation detail of the = AbstractBeanFactory class hierarchy, while BeanPostProcessor is supposed = to be a generic interface for all BeanFactory implementations. =20 I'll change AbstractBeanFactory's getMergedBeanDefinition to public. = That will allow for letting a BeanPostProcessor implement = BeanFactoryAware, and cast the passed BeanFactory to AbstractBeanFactory = to be able to invoke getMergedBeanDefinition. This way, a = BeanPostProcessor implementation can choose to be aware of bean = definitions but doesn't have to. =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Kopylenko, Dmitry Gesendet: Do 20.11.2003 22:01 An: 'spr...@li...' Betreff: RE: [Springframework-developer] AutoProxyCreator problem I believe that postProcessBean() used to have BeanDefinition as = argument. D. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Thursday, November 20, 2003 3:52 PM To: spr...@li... Subject: Re: [Springframework-developer] AutoProxyCreator problem Rod, You mean, modify the BeanPostProcessor interface method = postProcessBean() to include the bean definition? This would involve modifying = BeanPostProcessor implementations and the applyBeanPostProcessors() method of the AbstractBeanFactory class to include the bean definition. regards, Rajeev ----- Original Message ----- From: "Rod Johnson" <rod...@in...> To: <spr...@li...> Sent: Thursday, November 20, 2003 12:23 PM Subject: Re: [Springframework-developer] AutoProxyCreator problem > It's meant to be an SPI interface. However I think with the > PostProcessor API there may be a call for exposing the BeanDefinition > to _That_. Not via the BeanFactoyr interface though. > > R > ----- Original Message ----- > From: "Kopylenko, Dmitry" <dko...@su...> > To: <spr...@li...> > Sent: Thursday, November 20, 2003 8:00 PM > Subject: RE: [Springframework-developer] AutoProxyCreator problem > > > > Rajeev, > > > > You're right. There is no public API for getBeanDefinition(). There > > is a protected abstract getBeanDefinition(String) in > > AbstractBeanFactory > designed > > for subclasses to implement "Template Method" design pattern. > > > > Regards, > > Dmitriy. > > > > -----Original Message----- > > From: Rajeev Kaul [mailto:Ra...@cu...] > > Sent: Thursday, November 20, 2003 2:39 PM > > To: spr...@li... > > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > > > > > Dmitry, > > > > How do you get the bean definition from a bean factory? There does > > not > seem > > to be any public method for it. > > > > regards, > > > > Rajeev > > ----- Original Message ----- > > From: "Kopylenko, Dmitry" <dko...@su...> > > To: "'Rajeev Kaul '" <Ra...@cu...>; > > <spr...@li...> > > Sent: Wednesday, November 19, 2003 5:16 PM > > Subject: RE: [Springframework-developer] AutoProxyCreator problem > > > > > > > As to your first problem, you would need to create a new instance > > > of the BeanFactory Consider the following piece of code (taken > > > from > > > EnterpriseServices.createInvokerInterceptor() ): > > > > > > // Infinite cycle: tries to create the bean if we don't use a > > > different factory ListableBeanFactoryImpl bf2 =3D new > > > ListableBeanFactoryImpl(); bf2.registerBeanDefinition(beanName, > > > definition); cpii.setBeanFactory(bf2); > > > > > > ...where cpii is the reference of type > > > AbstractPoolingInvokerInterceptor which extends > > > PrototypeInvokerInterceptor > > > > > > I guess this is what you need. > > > > > > Dmitriy. > > > > > > -----Original Message----- > > > From: Rajeev Kaul > > > To: spr...@li... > > > Sent: 11/19/2003 7:33 PM > > > Subject: Re: [Springframework-developer] AutoProxyCreator problem > > > > > > I am thinking of a solution for condensing the verbose > > > configuration (shown below) for prototype business logic beans I > > > am using in my application. A shared controller instance > > > (singelton) creates the business logic bean. However the business > > > logic bean must be instantiated per each thread that runs through > > > the shared controller. I have been using the configuration shown > > > below: > > > > > > > > > <bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" > > > singleton=3D"false"> > > > > > > <property name=3D"count"><value>10</value></property> > > > > > > </bean> > > > > > > <bean id=3D"prototypeInvokerInterceptor" > > > = class=3D"org.springframework.aop.interceptor.PrototypeInvokerInterce > > > ptor > > > "> > > > > > > > > > <property > > > name=3D"targetBeanName"><value>prototypeBean</value></property> > > > > > > </bean> > > > > > > <bean id=3D"prototype" > > > class=3D"org.springframework.aop.framework.ProxyFactoryBean"> > > > > > > <property > > > = name=3D"interceptorNames"><value>prototypeInvokerInterceptor</value> > > > </pr > > > op > > > erty> > > > > > > </bean> > > > > > > > > > > > > As you can see this is very verbose, especially if you have a lot > > > of these business logic beans in your application. I tried using > > > a derived version of BeanNameAutoProxyCreator to solve this, but > > > ran into problems. I would like to replace this configuration with > > > something shown below: > > > > > > > > > > > > <bean id=3D"prototypeBean" class=3D"xyz.BusLogicBean" > > > singleton=3D"false" proxy=3D"prototype"> > > > > > > <property name=3D"count"><value>10</value></property> > > > > > > </bean> > > > > > > This would involve adding a "PROXY" attribute which would specify > > > the type of proxy interceptor desired for the bean. For example, > > > "prototype" would mean ProxyFactoryBean with > > > PrototypeInvokerInterceptor, "default" would mean ProxyFactoryBean > > > with InvokerInterceptor, etc. In loadBeanDefinition() method of > > > the XmlBeanFactory class, the supporting proxy classes > > > (ProxyFactoryBean and PrototypeInvokerInterceptor) could be > > > automatically generated and registered. > > > > > > Any suggestions, comments, ...? > > > > > > > > > > > > Rajeev > > > > > > ----- Original Message ----- > > > From: Rajeev Kaul <mailto:Ra...@cu...> > > > To: spr...@li... > > > <mailto:spr...@li...> > > > Sent: Tuesday, November 18, 2003 1:29 PM > > > Subject: [Springframework-developer] AutoProxyCreator problem > > > > > > > > > I have been trying to use BeanNameAutoProxyCreator class (I > > > noticed there are no test cases for it) to create proxies for > > > "prototype" business objects. I extended the > > > BeanNameAutoProxyCreator class to use the > > > PrototypeInvokerInterceptor in the "createInvokerInterceptor()" > > > method. However, this results in an infinite loop, as the > > > PrototypeInvokerInterceptor calls the beanFactory getBean() method > > > which in turn triggers the beanPostProcessor and the cycle repeats > > > endlessly. > > > > > > Any suggestions on getting around this problem? > > > > > > It would have been better, if the BeanNameAutoProxyCreator class > > > was designed to take invokerInterceptor as a property, which could > > > be specified in the configuration, instead of having to subclass > > > it to use other invokerInterceptor(s). > > > > > > Rajeev Kaul > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: SF.net Giveback Program. Does > > > SourceForge.net help you be more productive? Does it help you > > > create better code? SHARE THE LOVE, and help us help YOU! Click > > > Here: http://sourceforge.net/donate/ > > > _______________________________________________ > > > Springframework-developer mailing list > > > Spr...@li... > > > https://lists.sourceforge.net/lists/listinfo/springframework-devel > > > oper > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. Does > > SourceForge.net help you be more productive? Does it help you > > create > better > > code? SHARE THE LOVE, and help us help YOU! Click Here: > > http://sourceforge.net/donate/ > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-develop > > er > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. Does > > SourceForge.net help you be more productive? Does it help you > > create better code? SHARE THE LOVE, and help us help YOU! Click > > Here: http://sourceforge.net/donate/ > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-develop > > er > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. Does > SourceForge.net help you be more productive? Does it help you create > better code? SHARE THE LOVE, and help us help YOU! Click Here: > http://sourceforge.net/donate/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create = better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |