GH-3912: Handler: ignore Groovy generated methods

Fixes https://github.com/spring-projects/spring-integration/issues/3912

**Cherry-pick to `5.5.x`**
This commit is contained in:
Artem Bilan
2022-10-17 16:53:52 -04:00
committed by Gary Russell
parent beef2e68c7
commit c922905c1c
2 changed files with 73 additions and 34 deletions

View File

@@ -16,7 +16,7 @@
package org.springframework.integration.groovy.dsl.test
import groovy.transform.CompileStatic
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.annotation.Autowired
@@ -45,6 +45,7 @@ import reactor.core.publisher.Flux
import reactor.test.StepVerifier
import java.time.Duration
import java.util.concurrent.atomic.AtomicReference
import java.util.function.Function
import static org.springframework.integration.groovy.dsl.IntegrationGroovyDsl.integrationFlow
@@ -196,6 +197,19 @@ class GroovyDslTests {
assert this.wireTapChannel.receive(10_000)?.payload == 'test'
}
@Autowired
@Qualifier('externalServiceFlow.input')
private MessageChannel externalServiceFlowInput
@Autowired
GroovyTestService groovyTestService
@Test
void 'handle service'() {
this.externalServiceFlowInput.send(new GenericMessage<Object>('test'))
assert groovyTestService.result.get() == 'TEST'
}
@Configuration
@EnableIntegration
static class Config {
@@ -301,6 +315,30 @@ class GroovyDslTests {
}
}
@Bean
myService() {
new GroovyTestService()
}
@Bean
externalServiceFlow(GroovyTestService groovyTestService) {
integrationFlow {
handle groovyTestService
}
}
}
@CompileStatic
static class GroovyTestService {
AtomicReference<String> result = new AtomicReference<>()
void handlePayload(String payload) {
result.set payload.toUpperCase()
}
}
}