|
From: <jue...@we...> - 2003-12-03 15:45:56
|
PropertyValuesProviderFactoryBean is already dissolved :-) I think the simplest way to optionally apply BeanPostProcessors to = FactoryBean-created objects is to place the burden on the FactoryBean = implementation: It is the one that knows when the objects actually get = created and need BeanPostProcessors invoked on them. I've just introduced a "applyBeanPostProcessors(existingBean,name)" = method to the BeanFactory interface, accompanying the recently added = "autowireExistingBean(existingBean,autowireMode,dependencyCheck)" = method. A FactoryBean can implement BeanFactoryAware and invoke = applyBeanPostProcessors for a given object whenever it feels the need = to.=20 If a FactoryBean wants to pass its bean definition name to = BeanPostProcessors invoked on its created object, it can additionally = implement BeanNameAware, using that name for applyBeanPostProcessors = invocations. The alternative would be to place the burden on the BeanFactory = implementation, requiring special means to check that BeanPostProcessors = are just invoked once for any Factory-Bean created object. And that = would require a new XML bean definition attribute too, just applicable = to FactoryBeans, or a new method in the FactoryBean interface. As custom BeanPostProcessors are a rather rare requirement anyway, I = guess the programmatic solution should be sufficient. There's nothing a = BeanPostProcessor can do that you couldn't to with a custom FactoryBean = implementation, or an additional FactoryBean that fronts your existing = FactoryBean. Invoke the new applyBeanPostProcessors there if you need = to. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Rod Johnson Sent: Wednesday, December 03, 2003 1:33 PM To: spr...@li... Subject: Re: [Springframework-developer] FW: [springframework - Help] AOP interception of FactoryBean components? >Of course, a defined ProxyFactoryBean with a custom FactoryBean as = target would proxy the created object, as expected. But as Daniel noted, an = auto proxy creator would currently get applied to the FactoryBean instead of = the created object. >Should we leave it that way? Bean properties, lifecycle methods, and = also bean post processors like ApplicationContextAwareProcessor are in fact = meant to be applied on the FactoryBean itself. Could we add a clean option to apply bean post processors to the created objects, if demanded? I think we should leave it that way by default, and perhaps add an alternative option to post process created objects. >BTW, I think that our current PropertyValuesProviderFactoryBean sub-interface is useless. All the bean factory does with the = PropertyValues from there is to apply them to the created object via a newly = instantiated BeanWrapper: A FactoryBean implementation could easily do that itself = with a one-liner, if actually required. Good point. Get rid of it if you like. Regards, Rod ------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=3D8 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |