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.Constructor and Description |
---|
BambooProxyFactoryBean(String classNameForTypeCheck) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
Object |
getObject() |
Class<?> |
getObjectType() |
adviceChanged, createCompositeInterface, getProxy, isSingleton, setAdvisorAdapterRegistry, setAutodetectInterfaces, setBeanClassLoader, setBeanFactory, setFrozen, setInterceptorNames, setProxyClassLoader, setProxyInterfaces, setSingleton, setTargetName
addListener, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory
addAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorChainFactory, getAdvisors, getAdvisorsInternal, getInterceptorsAndDynamicInterceptionAdvice, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toString, updateAdvisorArray
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass
public BambooProxyFactoryBean(String classNameForTypeCheck)
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<Object>
getObjectType
in class org.springframework.aop.framework.ProxyFactoryBean
public Object getObject() throws org.springframework.beans.BeansException
getObject
in interface org.springframework.beans.factory.FactoryBean<Object>
getObject
in class org.springframework.aop.framework.ProxyFactoryBean
org.springframework.beans.BeansException
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.