What makes you think this is not being proxied?
Did you add @Component to your publisher?
Below is a sample I tested against head.
Regards
Jonas
Code:
@Component
public class PublisherBean {
public PublisherBean(){
System.out.println("publisher created");
}
@Publisher(channel="messageChannel")
public String getMessage(){
return (new Date()).toString() + " hello";
}
}
Code:
public class PublisherDemo {
public static void main(String[] args){
ApplicationContext appCtx = new ClassPathXmlApplicationContext("annotationDemo.xml", PublisherDemo.class);
PublisherBean publisher = (PublisherBean)appCtx.getBean("publisherBean");
publisher.getMessage();
publisher.getMessage();
}
}
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<message-bus />
<annotation-driven />
<context:component-scan base-package="org.springframework.integration.samples.annotations"/>
<channel id="messageChannel"/>
<console-target id="console"/>
<target-endpoint target="console" input-channel="messageChannel"></target-endpoint>
</beans:beans>