spring-xml로 프로젝트를 만들었을 때 다시 도움이 필요하지만 CallableProcessingInterceptor를 등록 할 수있는 방법을 모르므로 타임 아웃 후에 예외가 발생합니다.스프링 부트 비동기 Restcall 타임 아웃 처리
Spring-Boot 1.10을 사용 중입니다. 하나의 클라이언트 응용 프로그램이 RestApplication을 호출합니다. RestApplication의 응답 시간이 너무 오래 걸리면 클라이언트는 백그라운드에서 시간 초과를 발생 시키지만 브라우저에서는 아무 일도 일어나지 않습니다.
나는 이미 XML-Config를 사용할 때 TimeoutCallableProcessingInterceptor
이라는 클래스를 사용했습니다.
public class TimeoutCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter {
@Override
public <T> Object handleTimeout(final NativeWebRequest request, final Callable<T> task) throws Exception {
throw new IllegalStateException("[" + task.getClass().getName() + "] timed out");
}
}
====
WebMvcConfig
// Themeleaf and ApacheTiles Configs
...
@Bean
public TimeoutCallableProcessingInterceptor timeoutInterceptor() {
return new TimeoutCallableProcessingInterceptor();
}
어떻게 할 수 내가 인터셉터가 JAVACONFIG를 사용하여 해당 등록합니다.
자세한 정보가 필요하면 알려 주시기 바랍니다.
감사합니다.
먼저 그런 방법 configureAsyncSupport
을 덮어 WebMvcConfigurationSupport
으로 구성 클래스를 확장 :
또한 "표준"설정 옵션을 통해 가능해야한다 (즉,'server.session .timeout' 및/또는 보통'applications.properties | yml'에서'spring.mvc.async.request-timeout'). [공식 문서] (http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html) – demaniak