로컬에서는 잘 작동하던 인터셉터가 배포 후에는 작동이 안 되는 게 확인되었습니다.
인터셉터 등록 조차 되지 않아서 인터셉터 등록 방식을 변경했습니다. 원인은 모르겠습니다..
기존 인터셉터 등록 방식
@Configuration
public class CustomWebConfig extends WebMvcConfigurationSupport {
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new UserHandlerInterceptor());
}
}
변경 후
@Configuration
public class CustomWebConfig {
@Bean
public MappedInterceptor addInterceptors() {
return new MappedInterceptor(new String[]{"/**"}, new UserHandlerInterceptor());
}
}
참고
https://stackoverflow.com/questions/22633800/spring-mvc-interceptor-never-called
Spring MVC - Interceptor never called
I am trying to configure an interceptor in my application and I am not being able to make it work. In my application configuration class, I have configured in the following way: @Configuration @
stackoverflow.com
'Back-End > SpringBoot' 카테고리의 다른 글
[SpringBoot/WebClient] WebClient ClientResponse로 성공/실패 응답 객체 각각 받기 (0) | 2022.07.05 |
---|---|
[SpringBoot/MapStruct] MapStruct source 없이 default value 넣기 (0) | 2022.07.04 |
[SpringBoot] 슬랙 메시지 전송 (0) | 2022.05.21 |
[SpringBoot/JPA] @Embeddable, @EmbeddedId로 복합키 설정 (0) | 2022.05.21 |
[SpringBoot] JPA org.hibernate.LazyInitializationException: could not initialize proxy (0) | 2022.05.21 |