@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private MyInterceptor myInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(myInterceptor)
.addPathPatterns("/specific-url/**");
}
}
addPathPatterns() 메서드는 인터셉터가 /specific-url/로 시작하는 URL에만 적용되도록 지정하는 데 사용
반대로, 특정 URL을 제외해야 하는 경우 유사한 방식으로 excludePathPatterns() 메서드를 사용
'PROGRAMMING > JAVA' 카테고리의 다른 글
"Cannot cast from Object to long" 오류 이해 및 해결 방법 (0) | 2025.04.12 |
---|---|
redis watch/multi example (0) | 2023.03.11 |
Eclipse(Galileo) 에 SVN Client 설치하기 & 이클립스 svn 메뉴설명 (0) | 2014.07.30 |
[토비의 스프링 3.0] 1 장 오브젝트와 의존관계 (0) | 2013.02.20 |
날짜 구하기 (0) | 2013.01.10 |