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

org.zodiac.autoconfigure.web.remote.WebRemoteApiVersionMappingRegistrar 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.RemoteApiVersionMappingRegistrar;

public class WebRemoteApiVersionMappingRegistrar extends RemoteApiVersionMappingRegistrar {

    public WebRemoteApiVersionMappingRegistrar() {
    }

    @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);

        /*Register rqeust handler mapping.*/
        if (Springs.isReactiveWeb(getClass().getClassLoader(), getEnvironment(), getResourceLoader())) {
            registerRequestHandlerMapping(metadata, attrs, registry, ClassLoaders.loadClass("org.zodiac.core.web.remote.reactive.versions.RemoteApiVersionRequestHandlerMapping"),
                    beanNameGenerator);
        } else {
            registerRequestHandlerMapping(metadata, attrs, registry,
                ClassLoaders.loadClass("org.zodiac.core.web.remote.servlet.versions.RemoteApiVersionRequestHandlerMapping"), beanNameGenerator);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy