使用多线程处理rest请求
This commit is contained in:
+12
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
@@ -33,4 +34,15 @@ public class WebConfig extends WebMvcConfigurerAdapter{
|
||||
filterRegistrationBean.addUrlPatterns(urls);
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置异步请求的配置,异步请求的拦截器要在这里面进行设置,而不是普通的注册方式
|
||||
* 异步请求超时的配置
|
||||
* 异步请求线程池的设置
|
||||
* @param configurer
|
||||
*/
|
||||
@Override
|
||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
||||
configurer.setDefaultTimeout(1000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user