All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.web.remote.WebRemoteHandlerMappingRegistrar Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.web.remote;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;
import org.zodiac.commons.util.ClassLoaders;
import org.zodiac.commons.util.spring.Springs;
import org.zodiac.core.remote.annotation.RemoteHandlerMappingRegistrar;

public class WebRemoteHandlerMappingRegistrar extends RemoteHandlerMappingRegistrar {

    public WebRemoteHandlerMappingRegistrar() {
    }

    @Override
    protected boolean isSupported(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
        return true;
    }

    @Override
    protected void doRegister(AnnotationMetadata metadata, BeanDefinitionRegistry registry,
        BeanNameGenerator beanNameGenerator, AnnotationAttributes attrs) {
        super.doRegister(metadata, registry, beanNameGenerator, attrs);

        if (Springs.isReactiveWeb(getClass().getClassLoader(), getEnvironment(), getResourceLoader())) {
            /*Webflux*/
            registerSmartHandlerMappingConfigurer(metadata, attrs, registry, ClassLoaders.loadClass("org.zodiac.autoconfigure.web.WebFluxSmartHandlerMappingConfigurer"),
                    beanNameGenerator);
        } else {
            /*Webmvc*/
            registerSmartHandlerMappingConfigurer(metadata, attrs, registry, ClassLoaders.loadClass("org.zodiac.autoconfigure.web.WebMvcSmartHandlerMappingConfigurer"),
                    beanNameGenerator);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy