1 16 17 package org.springframework.aop.framework.adapter; 18 19 import org.springframework.beans.BeansException; 20 import org.springframework.beans.factory.config.BeanPostProcessor; 21 22 36 public class AdvisorAdapterRegistrationManager implements BeanPostProcessor { 37 38 private AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance(); 39 40 45 public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry) { 46 this.advisorAdapterRegistry = advisorAdapterRegistry; 47 } 48 49 public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { 50 return bean; 51 } 52 53 public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { 54 if (bean instanceof AdvisorAdapter){ 55 this.advisorAdapterRegistry.registerAdvisorAdapter((AdvisorAdapter) bean); 56 } 57 return bean; 58 } 59 60 } 61 | Popular Tags |