choose overloaded method in service activator (Spring Integration)

286 views Asked by At

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() ?

1

There are 1 answers

2
Artem Bilan On BEST ANSWER

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.