org.zodiac.autoconfigure.web.remote.WebRemoteHandlerMappingRegistrar Maven / Gradle / Ivy
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);
}
}
}