添加 拦截器方便调试
This commit is contained in:
parent
64a613cea6
commit
a27be660fe
@ -0,0 +1,21 @@
|
||||
package com.genersoft.iot.vmp.conf.security;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@SuppressWarnings({"unused"})
|
||||
@RequiredArgsConstructor
|
||||
public class RequestInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
log.info("访问 {}",request.getRequestURI());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.genersoft.iot.vmp.conf.security;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
private final RequestInterceptor requestInterceptor;
|
||||
@Override
|
||||
public void addInterceptors(@NotNull InterceptorRegistry registry) {
|
||||
registry.addInterceptor(requestInterceptor)
|
||||
.excludePathPatterns("/index/hook/**")
|
||||
.addPathPatterns("/**");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user