INT-1192 The @Publisher "value" attribute has been renamed "payload" for enhanced clarity (at the expense of "value" as a default when no name is provided... which is hindsight not worth it due to ambiguity).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,7 +59,7 @@ public class MethodAnnotationExpressionSource implements ExpressionSource {
|
||||
}
|
||||
|
||||
public String getPayloadExpression(Method method) {
|
||||
return this.getAnnotationValue(method, null, String.class);
|
||||
return this.getAnnotationValue(method, "payload", String.class);
|
||||
}
|
||||
|
||||
public String[] getHeaderExpressions(Method method) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ public @interface Publisher {
|
||||
* Message payload. The default will be empty, thereby causing the return
|
||||
* value to be used as the payload.
|
||||
*/
|
||||
String value() default "";
|
||||
String payload() default "";
|
||||
|
||||
/**
|
||||
* String representations of Spel Expressions to evaluate for adding any
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.core.Message;
|
||||
@@ -40,6 +41,7 @@ public class MessagePublishingAnnotationUsageTests {
|
||||
@Autowired
|
||||
private QueueChannel channel;
|
||||
|
||||
|
||||
@Test
|
||||
public void demoMessagePublishingInterceptor() {
|
||||
String name = testBean.setName("John", "Doe");
|
||||
@@ -53,7 +55,7 @@ public class MessagePublishingAnnotationUsageTests {
|
||||
|
||||
public static class TestBean {
|
||||
|
||||
@Publisher(value="#return", channel="testChannel", headers="bar='123'")
|
||||
@Publisher(channel="testChannel", payload="#return", headers="bar='123'")
|
||||
public String setName(String fname, String lname){
|
||||
return fname + " " + lname;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,15 +79,15 @@ public class MethodAnnotationExpressionSourceTests {
|
||||
}
|
||||
|
||||
|
||||
@Publisher("testExpression1")
|
||||
@Publisher(payload="testExpression1")
|
||||
public void methodWithExpressionAnnotationOnly(String arg1, int arg2) {
|
||||
}
|
||||
|
||||
@Publisher(value="#return", channel="foo", headers="bar=123")
|
||||
@Publisher(payload="#return", channel="foo", headers="bar=123")
|
||||
public void methodWithChannelAndReturnAsPayload() {
|
||||
}
|
||||
|
||||
@Publisher("testExpression2")
|
||||
@Publisher(payload="testExpression2")
|
||||
@ExpressionBinding(argumentVariableNames="s, i", argumentMapVariableName="argz",
|
||||
exceptionVariableName="x", returnValueVariableName="result")
|
||||
public void methodWithExpressionBinding(String arg1, int arg2) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,7 @@ public class PublisherAnnotationAdvisorTests {
|
||||
|
||||
static class TestBeanImpl implements TestBean {
|
||||
|
||||
@Publisher("#return")
|
||||
@Publisher(payload="#return")
|
||||
public String test() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user