I've been reviewing open issues with my current application, and some
of them seem to deal with using Spring.  This is kind of frustrating
because I'm finding that JSF managed beans do ALMOST everything I want
without Spring, except for providing a
InitializingBean.afterPropertiesSet() method call after a new bean's
properties have been set.

So after pondering it for a bit, it occurred to me that there's no
reason why support for this interface (repackaged for MyFaces) can't
be added to the org.apache.myfaces.el.VariableResolverImpl or to the
org.apache.myfaces.config.ManagedBeanBuilder class.

It seems to me that modifying one of the above classes to call the
below code would provide this functionality in a backward-compatible
way that does not affect the TCK.

if (newBean instanceof InitializingBean) 
((InitializingBean)newBean).afterPropertiesSet();

This could be done either as the last line in
ManagedBeanBuilder.buildManagedBean() or right after the call to
buildManagedBean() in VariableResolverImpl.resolveVariable.

Unfortunately, I can't see a way to adding this functionality cleanly
as a generic JSF tomahawk extension, so it would have to remain a
MyFaces-only feature.

Thoughts?

Reply via email to