SourceForge.net Logo

de.mindmatters.faces.spring.factory
Interface InstantiationProcessor

All Known Implementing Classes:
ManagedBeanMapOrListAutoProxyCreator, UIComponentAutoProxyCreator

public interface InstantiationProcessor

Allows for custom instantiation of beans, e.g. to suppress default instantiation for specific beans, to create proxies, etc.

FacesWebApplication contexts can auto-detect InstantiationProcessor beans in their bean definitions and apply them before any other beans get created. Plain bean factories of type ConfigurableBeanFactory allow for programmatic registration of instantiation-processors.

Author:
Andreas Kuhrwahl
See Also:
ConfigurableBeanFactory.addInstantiationProcessor(InstantiationProcessor), AbstractFacesWebApplicationContext, ConfigurableInstantiationStrategy

Method Summary
 java.lang.Object processBeforeInstantiation(java.lang.Class beanClass, java.lang.String beanName, java.lang.reflect.Constructor ctor, java.lang.Object[] args)
          Applied before the target bean gets instantiated.
 

Method Detail

processBeforeInstantiation

public java.lang.Object processBeforeInstantiation(java.lang.Class beanClass,
                                                   java.lang.String beanName,
                                                   java.lang.reflect.Constructor ctor,
                                                   java.lang.Object[] args)
Applied before the target bean gets instantiated. The returned bean object may be a proxy to use instead of the target bean.

If a non-null object is returned by this method, the bean instantiation process will be short-circuited.

This callback will only be applied to bean definitions with a bean class. In particular, it will not be applied to beans with a "factory-method".

Parameters:
beanClass - the class of the bean to be instantiated
beanName - the name of the bean
ctor - the constructor of the bean to be used for instantiation
args - the constructor arguments of the bean to be used for instantiation
Returns:
the bean object to expose or null when this instantiation processor is not responsible for instantiation
Throws:
BeansException - on instantiation errors

SourceForge.net Logo

Copyright © 2002 mindmatters GmbH & Co. KG