org.zodiac.autoconfigure.logging.trace.ServletLoggingTraceAutoConfiguration Maven / Gradle / Ivy
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