springboot中加tomcat中websocket传输大小限制问题

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.WebAppRootListener;

/**

  • websocket 传输大小限制问题
  • @author liu
  • @date: 2019年9月4日

*/
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class WebAppRootContext implements ServletContextInitializer {

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    System.out.println("org.apache.tomcat.websocket.textBufferSize");
    servletContext.addListener(WebAppRootListener.class);
    servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize","10240000");
}

}

你可能感兴趣的:(tomcat,springboot)