parent
a137fba38c
commit
3fd1bfc232
@ -1,25 +0,0 @@
|
|||||||
package com.xjs.annotation;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务之间的调用注解
|
|
||||||
* @author xiejs
|
|
||||||
* @since 2022-01-13
|
|
||||||
*/
|
|
||||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
public @interface RpcLog {
|
|
||||||
/**
|
|
||||||
* 请求服务方法
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
String method() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求服务名称
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
String serviceName() default "";
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.xjs.config;
|
||||||
|
|
||||||
|
import com.xjs.web.MyHandlerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mvc拦截配置
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-13
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new MyHandlerInterceptor());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.xjs.web;
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mvc拦截器
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-13
|
||||||
|
*/
|
||||||
|
public class MyHandlerInterceptor implements HandlerInterceptor {
|
||||||
|
@Override
|
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||||
|
|
||||||
|
//System.out.println("handler1"+handler);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue