/** * Invoked when advice chain is created. * <p>Add the given advice, advisor or object to the interceptor list. * Because of these three possibilities, we can't type the signature * more strongly. * @param next advice, advisor or target object * @param name bean name from which we obtained this object in our owning * bean factory */ private void addAdvisorOnChainCreation(Object next, String name) { // We need to convert to an Advisor if necessary so that our source reference // matches what we find from superclass interceptors. Advisor advisor = namedBeanToAdvisor(next); if (logger.isTraceEnabled()) { logger.trace("Adding advisor with name '" + name + "'"); } addAdvisor(advisor); }
Advisor refreshedAdvisor = namedBeanToAdvisor(bean); freshAdvisors.add(refreshedAdvisor);
/** * Invoked when advice chain is created. * <p>Add the given advice, advisor or object to the interceptor list. * Because of these three possibilities, we can't type the signature * more strongly. * @param next advice, advisor or target object * @param name bean name from which we obtained this object in our owning * bean factory */ private void addAdvisorOnChainCreation(Object next, String name) { // We need to convert to an Advisor if necessary so that our source reference // matches what we find from superclass interceptors. Advisor advisor = namedBeanToAdvisor(next); if (logger.isTraceEnabled()) { logger.trace("Adding advisor with name '" + name + "'"); } addAdvisor(advisor); }
/** * Invoked when advice chain is created. * <p>Add the given advice, advisor or object to the interceptor list. * Because of these three possibilities, we can't type the signature * more strongly. * @param next advice, advisor or target object * @param name bean name from which we obtained this object in our owning * bean factory */ private void addAdvisorOnChainCreation(Object next, String name) { if (logger.isDebugEnabled()) { logger.debug("Adding advisor or TargetSource [" + next + "] with name [" + name + "]"); } // We need to convert to an Advisor if necessary so that our source reference // matches what we find from superclass interceptors. Advisor advisor = namedBeanToAdvisor(next); // If it wasn't just updating the TargetSource. if (logger.isDebugEnabled()) { logger.debug("Adding advisor with name [" + name + "]"); } addAdvisor((Advisor) advisor); }
/** * Return an independent advisor chain. * We need to do this every time a new prototype instance is returned, * to return distinct instances of prototype Advisors and Advices. */ private List freshAdvisorChain() { Advisor[] advisors = getAdvisors(); List freshAdvisors = new ArrayList(advisors.length); for (int i = 0; i < advisors.length; i++) { if (advisors[i] instanceof PrototypePlaceholderAdvisor) { PrototypePlaceholderAdvisor pa = (PrototypePlaceholderAdvisor) advisors[i]; if (logger.isDebugEnabled()) { logger.debug("Refreshing bean named '" + pa.getBeanName() + "'"); } // Replace the placeholder with a fresh protoype instance resulting // from a getBean() lookup Object bean = this.beanFactory.getBean(pa.getBeanName()); Advisor refreshedAdvisor = namedBeanToAdvisor(bean); freshAdvisors.add(refreshedAdvisor); } else { // Add the shared instance. freshAdvisors.add(advisors[i]); } } return freshAdvisors; }
Advisor refreshedAdvisor = namedBeanToAdvisor(bean); freshAdvisors.add(refreshedAdvisor);