初始化
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package tech.easyflow.log.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import tech.easyflow.log.reporter.ActionLogReporterProperties;
|
||||
import tech.easyflow.log.reporter.ActionReportInterceptor;
|
||||
|
||||
@MapperScan("tech.easyflow.log.mapper")
|
||||
@Configuration
|
||||
public class LogModuleConfig implements WebMvcConfigurer {
|
||||
|
||||
private final ActionLogReporterProperties logProperties;
|
||||
private final ActionReportInterceptor actionReportInterceptor;
|
||||
|
||||
public LogModuleConfig(ActionLogReporterProperties logProperties,
|
||||
ActionReportInterceptor actionReportInterceptor) {
|
||||
this.logProperties = logProperties;
|
||||
this.actionReportInterceptor = actionReportInterceptor;
|
||||
|
||||
System.out.println("启用模块 >>>>>>>>>> module-log");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注册日志拦截器
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
if (!logProperties.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
registry.addInterceptor(actionReportInterceptor)
|
||||
.addPathPatterns(logProperties.getIncludePatterns().toArray(new String[0]))
|
||||
.excludePathPatterns(logProperties.getExcludePatterns().toArray(new String[0]));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user