Class BambooProxyFactoryBean

  • All Implemented Interfaces:
    Serializable, org.springframework.aop.framework.Advised, org.springframework.aop.TargetClassAware, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

    public class BambooProxyFactoryBean
    extends org.springframework.aop.framework.ProxyFactoryBean
    implements org.springframework.beans.factory.InitializingBean
    ProxyFactoryBean, when used with target bean reference, is unable to determine the produced object type during autowiring type checks. This results in a full instantiation of the Factory and the singleton object it produces, resulting in a dependency resultion storm across all bean factories when the first autowired dependency is being resolved. There are several solutions to this: * use targetName instead of target (not ideal, because you cannot inline the bean definition) * all top level dependencies on the target have to be made lazy * this class, which relies on the fact that the object type check has to use injection on the constructor to create the factory for the type check. The constructors is wired with the class name and is able to present it during the type check.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.springframework.aop.framework.ProxyFactoryBean

        GLOBAL_SUFFIX, logger
      • Fields inherited from class org.springframework.aop.framework.AdvisedSupport

        EMPTY_TARGET_SOURCE
      • Fields inherited from interface org.springframework.beans.factory.FactoryBean

        OBJECT_TYPE_ATTRIBUTE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      Object getObject()  
      Class<?> getObjectType()  
      • Methods inherited from class org.springframework.aop.framework.ProxyFactoryBean

        adviceChanged, createCompositeInterface, getProxy, isSingleton, setAdvisorAdapterRegistry, setAutodetectInterfaces, setBeanClassLoader, setBeanFactory, setFrozen, setInterceptorNames, setProxyClassLoader, setProxyInterfaces, setSingleton, setTargetName
      • Methods inherited from class org.springframework.aop.framework.ProxyCreatorSupport

        addListener, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory
      • Methods inherited from class org.springframework.aop.framework.AdvisedSupport

        addAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorChainFactory, getAdvisorCount, getAdvisors, getAdvisorsInternal, getInterceptorsAndDynamicInterceptionAdvice, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toString
      • Methods inherited from class org.springframework.aop.framework.ProxyConfig

        copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass
      • Methods inherited from interface org.springframework.aop.framework.Advised

        isExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy
    • Constructor Detail

      • BambooProxyFactoryBean

        public BambooProxyFactoryBean​(String classNameForTypeCheck)
    • Method Detail

      • getObjectType

        public Class<?> getObjectType()
        Specified by:
        getObjectType in interface org.springframework.beans.factory.FactoryBean<Object>
        Overrides:
        getObjectType in class org.springframework.aop.framework.ProxyFactoryBean
      • getObject

        public Object getObject()
                         throws org.springframework.beans.BeansException
        Specified by:
        getObject in interface org.springframework.beans.factory.FactoryBean<Object>
        Overrides:
        getObject in class org.springframework.aop.framework.ProxyFactoryBean
        Throws:
        org.springframework.beans.BeansException
      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean