Skip to content

@Publisher on a void-returning method does not accept param-level @Payload annotation [INT-2342] #6322

@spring-operator

Description

@spring-operator

Mark Fisher opened INT-2342 and commented

For example, the following should be valid:

@Publisher(channel="testChannel")
public void testVoidMethod(@Payload String s) {}

However, because the check for a valid "payloadExpression" on VOID-returning methods currently occurs PRIOR to the param-level annotation checking, it triggers the following Exception:

java.lang.IllegalArgumentException: When defining @Publisher on a void-returning method, an explicit payload expression that does not rely upon a #return value is required.
	at org.springframework.util.Assert.isTrue(Assert.java:65)
	at org.springframework.integration.aop.MethodAnnotationPublisherMetadataSource.getPayloadExpression(MethodAnnotationPublisherMetadataSource.java:84)...

It appears that this can be resolved by simply moving the IF-block where that void-return method check occurs so that it is AFTER the param-level annotation check.


No further details from INT-2342

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions