InterceptorConfig.java

팡태(❁´◡`❁)·2022년 4월 6일
0

SPRING_20220328

목록 보기
12/24

example/config/InterceptorConfig.java

package com.example.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer{

    @Autowired
    HandlerInterceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
            .addPathPatterns("/**")
            .excludePathPatterns(
                "/member/login/**", 
                "/member/logout/**", 
                "/resources/**",
                "/item/image/**",
                "/shop/cart/**",
                "/item/subimage/**",
                "/css/**"
            );
    }
}

0개의 댓글