File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
service-customer/src/main/java/com/coderqian/eurekacustomer
configuration/interceptors Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 33import com .alibaba .fastjson .serializer .SerializerFeature ;
44import com .alibaba .fastjson .support .config .FastJsonConfig ;
55import com .alibaba .fastjson .support .spring .FastJsonHttpMessageConverter ;
6+ import com .coderqian .eurekacustomer .interceptor .MonitorInterceptor ;
7+ import org .springframework .beans .factory .annotation .Autowired ;
8+ import org .springframework .context .annotation .Configuration ;
69import org .springframework .http .converter .HttpMessageConverter ;
10+ import org .springframework .stereotype .Component ;
711import org .springframework .web .servlet .config .annotation .InterceptorRegistry ;
812import org .springframework .web .servlet .config .annotation .WebMvcConfigurerAdapter ;
913
1721 * 配置自定义拦截器
1822 */
1923
24+ @ Configuration
2025public class WebAppConfigurer extends WebMvcConfigurerAdapter {
2126
27+ @ Autowired
28+ private MonitorInterceptor monitorInterceptor ;
29+
2230 @ Override
2331 public void addInterceptors (InterceptorRegistry registry ) {
2432// registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/**");
33+ registry .addInterceptor (monitorInterceptor );
2534 super .addInterceptors (registry );
2635 }
2736
Original file line number Diff line number Diff line change @@ -35,11 +35,11 @@ public Object serviceThreadLocalHandle(ProceedingJoinPoint joinPoint) throws Thr
3535 Parameter [] parameters = method .getParameters ();
3636 String targetClassName = joinPoint .getTarget ().getClass ().getName ();
3737 Object [] args = joinPoint .getArgs ();
38- LogUtils .info ("className:" + targetClassName );
39- LogUtils .info ("methodName:" + methodName );
38+ LogUtils .info ("className: " + targetClassName );
39+ LogUtils .info ("methodName: " + methodName );
4040 if (args != null && args .length > 0 ) {
4141 for (int i = 0 ; i < args .length ; i ++) {
42- LogUtils .info (parameters [i ].getName () + " : " + parameters [i ].getType ().getName () + " : " + args [i ]);
42+ LogUtils .info (parameters [i ].getName () + ": " + parameters [i ].getType ().getName () + ": " + args [i ]);
4343 }
4444 }
4545 return joinPoint .proceed ();
You can’t perform that action at this time.
0 commit comments