|
From: Kopylenko, D. <dko...@ac...> - 2003-11-20 21:01:34
|
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 = 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="prototypeBean" class="xyz.BusLogicBean" > > > singleton="false"> > > > > > > <property name="count"><value>10</value></property> > > > > > > </bean> > > > > > > <bean id="prototypeInvokerInterceptor" > > > class="org.springframework.aop.interceptor.PrototypeInvokerInterce > > > ptor > > > "> > > > > > > > > > <property > > > name="targetBeanName"><value>prototypeBean</value></property> > > > > > > </bean> > > > > > > <bean id="prototype" > > > class="org.springframework.aop.framework.ProxyFactoryBean"> > > > > > > <property > > > name="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="prototypeBean" class="xyz.BusLogicBean" > > > singleton="false" proxy="prototype"> > > > > > > <property name="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 |