org.zodiac.autoconfigure.log.PlatformLogToolReactiveAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.log;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
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.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.zodiac.autoconfigure.log.condition.ConditionalOnPatformLogRequestEnabled;
import org.zodiac.autoconfigure.security.http.reactive.SecurityHttpReactiveAutoConfiguration;
@SpringBootConfiguration
@ConditionalOnPatformLogRequestEnabled
@ConditionalOnWebApplication(type = Type.REACTIVE)
@AutoConfigureAfter(value = SecurityHttpReactiveAutoConfiguration.class)
//@AutoConfigureAfter(value = {PlatformLogToolAutoConfiguration.class})
@ConditionalOnClass(value = {org.zodiac.log.LogOperations.class, org.springframework.web.server.WebHandler.class, org.springframework.web.reactive.DispatcherHandler.class})
public class PlatformLogToolReactiveAutoConfiguration {
private final PlatformRequestLogProperties platformRequestLogProperties;
private final ApplicationContext applicationContext;
public PlatformLogToolReactiveAutoConfiguration(PlatformRequestLogProperties platformRequestLogProperties,
ApplicationContext applicationContext) {
this.platformRequestLogProperties = platformRequestLogProperties;
this.applicationContext = applicationContext;
}
@Bean
@ConditionalOnMissingBean
@Order(value = Ordered.LOWEST_PRECEDENCE)
protected org.zodiac.log.filter.ReactiveLogTraceFilter logTraceFilter() {
return new org.zodiac.log.filter.ReactiveLogTraceFilter(applicationContext);
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.log.aspect.RequestLogAspect requestLogAspect() {
return new org.zodiac.log.aspect.ReactiveRequestLogAspect(platformRequestLogProperties);
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.log.error.PlatformRestExceptionTranslator platformRestExceptionTranslator(org.zodiac.log.publisher.ErrorLogApplicationPublisher errorLogPublisher) {
return new org.zodiac.log.error.PlatformReactiveRestExceptionTranslator(errorLogPublisher);
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.log.error.ReactiveRestExceptionTranslator reactiveRestExceptionTranslator() {
return new org.zodiac.log.error.ReactiveRestExceptionTranslator();
}
}