Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
        public virtual object postProcessAfterInitialization(object bean, string beanName)
        {
            if (bean is AopInfrastructureBean)
            {
                // Ignore AOP infrastructure such as scoped proxies.
                return(bean);
            }
            Type targetClass = AopUtils.getTargetClass(bean);

            if (AopUtils.canApply(this.advisor, targetClass))
            {
                if (bean is Advised)
                {
                    ((Advised)bean).addAdvisor(0, this.advisor);
                    return(bean);
                }
                else
                {
                    ProxyFactory proxyFactory = new ProxyFactory(bean);
                    // Copy our properties (proxyTargetClass etc) inherited from ProxyConfig.
                    proxyFactory.copyFrom(this);
                    proxyFactory.addAdvisor(this.advisor);
                    return(proxyFactory.getProxy(this.beanClassLoader));
                }
            }
            else
            {
                // No async proxy needed.
                return(bean);
            }
        }