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

org.zodiac.autoconfigure.boot.reactive.PlatformRequestReactiveAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.boot.reactive;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.zodiac.autoconfigure.boot.PlatformRequestProperties;
import org.zodiac.autoconfigure.boot.condition.ConditionalOnPatformRequestEnabled;

/**
 * 过滤器配置类。
 *
 */
@ConditionalOnPatformRequestEnabled
@ConditionalOnWebApplication(type = Type.REACTIVE)
@SpringBootConfiguration
@ConditionalOnClass(value = {org.zodiac.boot.ctrl.PlatformRemoteService.class, org.springframework.web.server.WebHandler.class, org.springframework.web.reactive.DispatcherHandler.class})
public class PlatformRequestReactiveAutoConfiguration {

    protected final Logger log = LoggerFactory.getLogger(getClass());

    private final PlatformRequestProperties platformRequestProperties;

    public PlatformRequestReactiveAutoConfiguration(PlatformRequestProperties platformRequestProperties) {
        this.platformRequestProperties = platformRequestProperties;
        log.info("{} loaded.", getClass().getCanonicalName());
    }

    /**
     * 全局过滤器。
     * 
     * @return 过滤器
     */
    @Bean
    @ConditionalOnMissingBean
    @Order(value = Ordered.LOWEST_PRECEDENCE)
    protected org.zodiac.boot.request.PlatformReactiveRequestFilter platformRequestFilter() {
        return new org.zodiac.boot.request.PlatformReactiveRequestFilter(platformRequestProperties);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy