|
@@ -1,12 +1,16 @@
|
|
|
package com.persagy.apm.energy.report.common;
|
|
|
|
|
|
+import com.persagy.apm.common.handler.PoemsContextFilter;
|
|
|
import com.persagy.apm.common.handler.PoemsContextHandler;
|
|
|
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
+import javax.servlet.Filter;
|
|
|
+
|
|
|
/**
|
|
|
* web拦截器配置
|
|
|
*
|
|
@@ -22,10 +26,27 @@ public class PoemsWebConfigurer implements WebMvcConfigurer {
|
|
|
return new PoemsContextHandler();
|
|
|
}
|
|
|
|
|
|
+ @Bean
|
|
|
+ public Filter poemsContextFilter() {
|
|
|
+ return new PoemsContextFilter();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
// 设置拦截的路径、不拦截的路径、优先级等等
|
|
|
registry.addInterceptor(poemsContextHandler()).order(10).addPathPatterns("/**");
|
|
|
}
|
|
|
|
|
|
+// @Bean
|
|
|
+// public FilterRegistrationBean contextFilterRegistrationBean() {
|
|
|
+// FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
|
|
+// registrationBean.setFilter(poemsContextFilter());
|
|
|
+// registrationBean.addUrlPatterns("/*");
|
|
|
+// registrationBean.setName("PoemsContextFilter");
|
|
|
+// registrationBean.setOrder(1);
|
|
|
+// return registrationBean;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|