GH-2752: RequestMapping: react only for our event
Fixes https://github.com/spring-projects/spring-integration/issues/2752 The logic in the `IntegrationRequestMappingHandlerMapping` fully depends on the application context it has been registered with, therefore any arbitrary `ContextRefreshedEvent` doesn't fit our requirements. More over it may cause a problem with missed mappings when parent-child configuration is used. **Chery-pick to 5.1.x, 5.0.x & 4.3.x**
This commit is contained in:
committed by
Gary Russell
parent
72aaf0b03f
commit
44f438d3f2
@@ -187,11 +187,6 @@ public final class IntegrationRequestMappingHandlerMapping extends RequestMappin
|
||||
return createRequestMappingInfo(requestMappingAnnotation, getCustomTypeCondition(endpoint.getClass()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
// No-op in favor of onApplicationEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link HttpRequestHandlingEndpointSupport}s may depend on auto-created
|
||||
* {@code requestChannel}s, so MVC Handlers detection should be postponed
|
||||
@@ -200,9 +195,14 @@ public final class IntegrationRequestMappingHandlerMapping extends RequestMappin
|
||||
*/
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
if (!this.initialized.getAndSet(true)) {
|
||||
if (event.getApplicationContext().equals(getApplicationContext()) && !this.initialized.getAndSet(true)) {
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
// No-op in favor of onApplicationEvent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user