Example usage for org.springframework.integration.webflux.support WebFluxContextUtils HANDLER_MAPPING_BEAN_NAME

List of usage examples for org.springframework.integration.webflux.support WebFluxContextUtils HANDLER_MAPPING_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.integration.webflux.support WebFluxContextUtils HANDLER_MAPPING_BEAN_NAME.

Prototype

String HANDLER_MAPPING_BEAN_NAME

To view the source code for org.springframework.integration.webflux.support WebFluxContextUtils HANDLER_MAPPING_BEAN_NAME.

Click Source Link

Document

The name for the infrastructure org.springframework.integration.webflux.inbound.WebFluxIntegrationRequestMappingHandlerMapping bean.

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>//from   w  w  w  .  j  a v 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);
    }
}