List of usage examples for org.springframework.aop.support NameMatchMethodPointcutAdvisor getPointcut
@Override
public Pointcut getPointcut()
From source file:org.springframework.integration.config.ConsumerEndpointFactoryBean.java
public void afterPropertiesSet() throws Exception { try {//from w ww . ja v a2s . co m if (!this.beanName.startsWith("org.springframework")) { MessageHandler targetHandler = this.handler; if (AopUtils.isAopProxy(targetHandler)) { Object target = ((Advised) targetHandler).getTargetSource().getTarget(); if (target instanceof MessageHandler) { targetHandler = (MessageHandler) target; } } if (targetHandler instanceof IntegrationObjectSupport) { ((IntegrationObjectSupport) targetHandler).setComponentName(this.beanName); } } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not set component name for handler " + this.handler + " for " + this.beanName + " :" + e.getMessage()); } } if (!CollectionUtils.isEmpty(this.adviceChain)) { /* * ARPMHs advise the handleRequesMessage method internally and already have the advice chain injected. * So we only advise handlers that are not reply-producing. If the handler is already advised, * add the configured advices to its chain, otherwise create a proxy. */ if (!(this.handler instanceof AbstractReplyProducingMessageHandler)) { if (AopUtils.isAopProxy(this.handler) && this.handler instanceof Advised) { Class<?> targetClass = AopUtils.getTargetClass(this.handler); for (Advice advice : this.adviceChain) { NameMatchMethodPointcutAdvisor handlerAdvice = new NameMatchMethodPointcutAdvisor(advice); handlerAdvice.addMethodName("handleMessage"); if (AopUtils.canApply(handlerAdvice.getPointcut(), targetClass)) { ((Advised) this.handler).addAdvice(advice); } } } else { ProxyFactory proxyFactory = new ProxyFactory(this.handler); for (Advice advice : this.adviceChain) { proxyFactory.addAdvice(advice); } this.handler = (MessageHandler) proxyFactory.getProxy(this.beanClassLoader); } } } this.initializeEndpoint(); }