Implement Lifecycle for IntegrationComponentSpec

Since an `IntegrationComponentSpec` is a `FactoryBean`, all it's target
callbacks and lifecycle is controlled over a `FactoryBean`.

* Add `SmartLifecycle` for the `IntegrationComponentSpec` to delegate
lifecycle hooks to the `target` if necessary
* Refactor `IntegrationComponentSpec` to be an `AbstractFactoryBean`
which is a central place for the `FactoryBean`, `InitializingBean` and
`DisposableBean` interfaces

**Cherry-pick to 5.0.x**
This commit is contained in:
Artem Bilan
2019-01-22 18:27:08 -05:00
committed by Gary Russell
parent 119db815c2
commit 690a2c3c3e
2 changed files with 73 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2016-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -210,12 +210,17 @@ public class HttpDslTests {
.get();
}
@Bean
public HttpRequestHandlerEndpointSpec httpService() {
return Http.inboundGateway("/service")
.requestMapping(r -> r.params("name"))
.errorChannel("httpProxyErrorFlow.input");
}
@Bean
public IntegrationFlow httpProxyFlow() {
return IntegrationFlows
.from(Http.inboundGateway("/service")
.requestMapping(r -> r.params("name"))
.errorChannel("httpProxyErrorFlow.input"))
.from(httpService())
.handle(Http.outboundGateway("/service/internal?{params}")
.uriVariable("params", "payload")
.expectedResponseType(String.class)