Spring Boot enable like in web.xml

后端 未结 3 2155
猫巷女王i
猫巷女王i 2020-12-09 22:52

I have a problem with Spring Boot configuration. I got exception on some mobile devices which should use sockets:

java.lang.IllegalArgumentException: Async s         


        
3条回答
  •  悲&欢浪女
    2020-12-09 23:30

    You just need to define dispatcherServlet @Bean:

    @Bean
    public ServletRegistrationBean dispatcherServlet() {
        ServletRegistrationBean registration = new ServletRegistrationBean(
                new DispatcherServlet(), "/");
        registration.setAsyncSupported(true);
        return registration;
    }
    

    It overrides that default one from DispatcherServletAutoConfiguration.

提交回复
热议问题