Just as addition to the solution described by Colin, see this thread. It also contains an example for the application context.
Regards,
Andreas
Just as addition to the solution described by Colin, see this thread. It also contains an example for the application context.
Regards,
Andreas
Hey Andreas! You know what they say, "great minds think alike", but then they also say "fools seldom differ". Not sure which category I fall inOriginally Posted by Andreas Senft
![]()
I would suggest that my BeanPostProcessor solution is a little more elegant (and safer) than implementing FactoryBeanAware (or ApplicationContextAware) and InitialisingBean simply because if the bean is a prototype you then setThis will be called with a different instance, which is absolutely what you do not want
I really must blog this...time and all that.
Colin Yates
SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
Please read http://www.springframework.org/documentation
Co-Author of Expert Spring MVC + Web Flow.
...or IOriginally Posted by yatesco
![]()
I agree. Only wondering, where I suggested implementing FactoryBeanAware? I guess you refer to my explicit usage of ProxyFactoryBean. In that case, yes, for prototypes it would be a problem.Originally Posted by yatesco
Yes, that would really be a good topic.Originally Posted by yatesco
Regards,
Andreas
I am not sure who referred to it, someone mentioned (I also mentioned this as well) that if your bean implemented FactoryBeanAware/ApplicationContextAware it could then do aOriginally Posted by Andreas Senft
etc. but this absolutely ties you down to spring and you need to implement BeanNameAware, ApplicationContextAware and InitialisingBean!Code:setApplicationContext(ApplicationContext ctx) { this._decoratedThis = ctx.getBean(getBeanName()) }
Colin Yates
SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
Please read http://www.springframework.org/documentation
Co-Author of Expert Spring MVC + Web Flow.