A message is received on a channel, and is processed by a transformer. The output of the transformer is the following class, which is passed on to the next step in the flow:
public class DomainBean{
public DomainBean process() {
// code
return this;
}
}
Another bean has a @Transformer
method which calls the process
method on the bean above, as follows:
@Component
public class Handler {
@Transformer
public Object handle(Message<?> message) throws MessagingException {
DomainBean domainBean = (DomainBean) message;
domainBean.process();
return domainBean ;
}
}
Within the IntegrationFlow, the handle
method is invoked as follows:
.transform(handler)
Ideally I would like to do away with the Handler
bean class, and call domainBean.process()
using an object method reference, as follows:
.transform(DomainBean::process)
When I try that, or .<DomainBean, DomainBean>transform(DomainBean::process)
compiler complains that
Non-static method cannot be referenced from a static context
Is there anyway to make this work?
Thanks