Table of Content
Spring Boot – WebFilter 활성화
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
의존성 추가
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
}
@ServletComponentScan 추가
@ServletComponentScan
@SpringBootApplication
public class WarehousewebApplication {
public static void main(String[] args) {
SpringApplication.run(WarehousewebApplication.class, args);
}
}
Filter 추가
@WebFilter("/*")
public class LoggingFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
// HttpServletResponse httpServletResponse = (HttpServletResponse) response;
System.out.println(httpServletRequest.getRequestURI());
chain.doFilter(request, response);
}
}