0

I defined a serviceActivator :

<integration:service-activator input-channel="sampleChannel" 
ref="sampleImpl" method="remove"/>

In SampleImpl, There are two overloaded method of remove :

 public Object remove(Object payload) {
    //some code ...
    return payload;
}

 public void remove() {
  //some code ...
}

In method property, I want to choose remove method without argument ( remove() ). and in some scenario, I want to choose remove method with argument ( remove(Object payload) ). I found always pass payload as argument to remove method, so how can I choose only remove() ?

Hamid
  • 153
  • 1
  • 2
  • 9

1 Answers1

1

It’s impossible with XML DSL. You have to rename one of them or write wrapper services. That’s similar to setter selection in Java Beans. So, if you want there different logic with different setters, you have name them with distinct words.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • It means I can't use overloaded methods in service activator. Right ? – Hamid Nov 26 '17 at 15:51
  • Right, you can’t. The one with an argument is selected by name. Well, that one without arguments is considered as well, but since request message always has a payload, the Framework never select the method without arguments – Artem Bilan Nov 26 '17 at 16:12