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

org.zodiac.autoconfigure.logging.trace.ServletLoggingTraceAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.logging.trace;

import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.zodiac.autoconfigure.logging.trace.condition.ConditionalOnLoggingTraceMessageEnabled;
import org.zodiac.commons.logging.trace.servlet.LoggingMessageServletFilter;

@SpringBootApplication
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnLoggingTraceMessageEnabled
@Order(value = Ordered.HIGHEST_PRECEDENCE)
@AutoConfigureOrder(value = Ordered.HIGHEST_PRECEDENCE + 10)
public class ServletLoggingTraceAutoConfiguration {

    public ServletLoggingTraceAutoConfiguration() {
        super();
    }

    @Bean
    protected LoggingMessageServletFilter loggingMessageServletFilter(
        ApplicationContext context, LoggingMessageProperties loggingMessageProperties) {
        return new LoggingMessageServletFilter(context, loggingMessageProperties);
    }

    @Bean
    protected FilterRegistrationBean loggingMessageRegistrationBean(
            LoggingMessageProperties loggingConfig,
            LoggingMessageServletFilter filter) {
        FilterRegistrationBean filterBean = new FilterRegistrationBean<>();
        filterBean.setFilter(filter);
        filterBean.setOrder(loggingConfig.getFilterOrder());
        return filterBean;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy