From dc004febf7a4356540cfc0fb10024c34055b3f6c Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Fri, 18 Jun 2010 20:51:59 +0000 Subject: [PATCH] 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). --- .../integration/aop/MethodAnnotationExpressionSource.java | 4 ++-- .../org/springframework/integration/aop/Publisher.java | 4 ++-- .../aop/MessagePublishingAnnotationUsageTests.java | 6 ++++-- .../aop/MethodAnnotationExpressionSourceTests.java | 8 ++++---- .../integration/aop/PublisherAnnotationAdvisorTests.java | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/MethodAnnotationExpressionSource.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/MethodAnnotationExpressionSource.java index e23ca1f8c0..f4c368fc0f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/MethodAnnotationExpressionSource.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/MethodAnnotationExpressionSource.java @@ -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) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/Publisher.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/Publisher.java index 731293c762..1ab3b3aedf 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/Publisher.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/Publisher.java @@ -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 diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java index db5df2b0a6..1a76c1067b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/MessagePublishingAnnotationUsageTests.java @@ -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; } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationExpressionSourceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationExpressionSourceTests.java index 29dd2e6c37..7504d3f080 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationExpressionSourceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/MethodAnnotationExpressionSourceTests.java @@ -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) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java index d04fd32c54..2cec09f97c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aop/PublisherAnnotationAdvisorTests.java @@ -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"; }