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

pro.chenggang.plugin.springcloud.gateway.config.RequestResponseLogConfig Maven / Gradle / Ivy

There is a newer version: 2.1.SR2.2.RELEASE
Show newest version
package pro.chenggang.plugin.springcloud.gateway.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import pro.chenggang.plugin.springcloud.gateway.filter.RequestLogFilter;
import pro.chenggang.plugin.springcloud.gateway.filter.ResponseLogFilter;
import pro.chenggang.plugin.springcloud.gateway.properties.GatewayPluginProperties;

/**
 * Gateway Plugin Config
 * @author chenggang
 * @date 2019/01/29
 */
@Slf4j
@Configuration
public class RequestResponseLogConfig {

    @Bean
    @ConditionalOnMissingBean(RequestLogFilter.class)
    @ConditionalOnProperty(prefix = GatewayPluginProperties.GATEWAY_PLUGIN_PROPERTIES_PREFIX,value = "log-request",havingValue = "true")
    public RequestLogFilter requestLogFilter(){
        RequestLogFilter requestLogFilter = new RequestLogFilter();
        log.debug("Load Request Log Filter Config Bean");
        return requestLogFilter;
    }

    @Bean
    @ConditionalOnMissingBean(ResponseLogFilter.class)
    @ConditionalOnProperty(prefix = GatewayPluginProperties.GATEWAY_PLUGIN_PROPERTIES_PREFIX,value = "log-request",havingValue = "true")
    public ResponseLogFilter responseLogFilter(){
        ResponseLogFilter responseLogFilter = new ResponseLogFilter();
        log.debug("Load Response Log Filter Config Bean");
        return responseLogFilter;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy