Example usage for org.springframework.integration.http.config HttpContextUtils WEB_FLUX_PRESENT

List of usage examples for org.springframework.integration.http.config HttpContextUtils WEB_FLUX_PRESENT

Introduction

In this page you can find the example usage for org.springframework.integration.http.config HttpContextUtils WEB_FLUX_PRESENT.

Prototype

boolean WEB_FLUX_PRESENT

To view the source code for org.springframework.integration.http.config HttpContextUtils WEB_FLUX_PRESENT.

Click Source Link

Document

A boolean flag to indicate if the org.springframework.web.reactive.DispatcherHandler is present in the CLASSPATH to allow the registration of Integration server reactive components, e.g.

Usage

From source file:org.springframework.integration.webflux.config.WebFluxIntegrationConfigurationInitializer.java

/**
 * Registers a {@link WebFluxIntegrationRequestMappingHandlerMapping}
 * which could also be overridden by the user by simply registering
 * a {@link WebFluxIntegrationRequestMappingHandlerMapping} {@code <bean>} with 'id'
 * {@link WebFluxContextUtils#HANDLER_MAPPING_BEAN_NAME}.
 * <p>/*  w w w  .  jav  a2  s . c o m*/
 * In addition, checks if the {@code org.springframework.web.reactive.result.method.RequestMappingInfo}
 * class is present on the classpath.
 * When Spring Integration HTTP is used only as an HTTP client, there is no reason to use and register
 * the HTTP server components.
 */
private void registerReactiveRequestMappingHandlerMappingIfNecessary(BeanDefinitionRegistry registry) {
    if (HttpContextUtils.WEB_FLUX_PRESENT
            && !registry.containsBeanDefinition(WebFluxContextUtils.HANDLER_MAPPING_BEAN_NAME)) {
        BeanDefinitionBuilder requestMappingBuilder = BeanDefinitionBuilder
                .genericBeanDefinition(WebFluxIntegrationRequestMappingHandlerMapping.class);
        requestMappingBuilder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        requestMappingBuilder.addPropertyValue(IntegrationNamespaceUtils.ORDER, 0);
        registry.registerBeanDefinition(WebFluxContextUtils.HANDLER_MAPPING_BEAN_NAME,
                requestMappingBuilder.getBeanDefinition());

        BeanDefinitionReaderUtils.registerWithGeneratedName(
                new RootBeanDefinition(IntegrationHandlerResultHandler.class), registry);
    }
}