Search in sources :

Example 6 with NameMatchMethodPointcutAdvisor

use of org.springframework.aop.support.NameMatchMethodPointcutAdvisor in project spring-integration by spring-projects.

the class MessageMetricsAdviceTests method exportAdvisedChannel.

@Test
public void exportAdvisedChannel() throws Exception {
    DummyInterceptor interceptor = new DummyInterceptor();
    NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor(interceptor);
    advisor.addMethodName("send");
    ProxyFactory factory = new ProxyFactory(channel);
    factory.addAdvisor(advisor);
    MessageChannel advised = (MessageChannel) factory.getProxy();
    this.beanFactory.registerSingleton("test", advised);
    this.beanFactory.initializeBean(advised, "test");
    mBeanExporter.afterSingletonsInstantiated();
    MessageChannel exported = this.beanFactory.getBean("test", MessageChannel.class);
    exported.send(MessageBuilder.withPayload("test").build());
}
Also used : MessageChannel(org.springframework.messaging.MessageChannel) ProxyFactory(org.springframework.aop.framework.ProxyFactory) NameMatchMethodPointcutAdvisor(org.springframework.aop.support.NameMatchMethodPointcutAdvisor) Test(org.junit.Test)

Aggregations

NameMatchMethodPointcutAdvisor (org.springframework.aop.support.NameMatchMethodPointcutAdvisor)6 ProxyFactory (org.springframework.aop.framework.ProxyFactory)5 MessageHandler (org.springframework.messaging.MessageHandler)3 Advice (org.aopalliance.aop.Advice)2 Test (org.junit.Test)2 Advised (org.springframework.aop.framework.Advised)2 AbstractReplyProducingMessageHandler (org.springframework.integration.handler.AbstractReplyProducingMessageHandler)2 HandleMessageAdvice (org.springframework.integration.handler.advice.HandleMessageAdvice)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MethodInterceptor (org.aopalliance.intercept.MethodInterceptor)1 MethodInvocation (org.aopalliance.intercept.MethodInvocation)1 DefaultBeanFactoryPointcutAdvisor (org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor)1 NameMatchMethodPointcut (org.springframework.aop.support.NameMatchMethodPointcut)1 NoSuchBeanDefinitionException (org.springframework.beans.factory.NoSuchBeanDefinitionException)1 Bean (org.springframework.context.annotation.Bean)1 Order (org.springframework.core.annotation.Order)1 IdempotentReceiver (org.springframework.integration.annotation.IdempotentReceiver)1 IntegrationObjectSupport (org.springframework.integration.context.IntegrationObjectSupport)1 Orderable (org.springframework.integration.context.Orderable)1