Arquivo da tag: Tomcat-embedded

Spring Boot Tomcat Configuration, migration from container to embedded

I’m migrating a Spring boot application that used to run in the Tomcat container to a Spring Boot application that runs an embedded Tomcat. My old Tomcat configuration has these configurations in the server.xml:
[code type=xml]

I was able to set up most of the properties using a bean
[code type=java]
@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
tomcatEmbeddedServletContainerFactory.setProtocol(“org.apache.coyote.http11.Http11Nio2Protocol”);
tomcatEmbeddedServletContainerFactory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
AbstractHttp11JsseProtocol handler = (AbstractHttp11JsseProtocol)connector.getProtocolHandler();
handler.setMaxKeepAliveRequests(-1);
handler.setAcceptorThreadCount(2);
handler.setMaxHeaderCount(256);
connector.setRedirectPort(8443);
});

return tomcatEmbeddedServletContainerFactory;
}

And application.properties:
[code type=properties]
server.tomcat.accept-count = 500
server.tomcat.max-threads = 600
server.port = 8080
server.max-http-header-size = 32768
server.connection-timeout = 20000

However I cannot figure out how to set this part
[code type=properties]
useComet=”false”
socket.appReadBufSize=”87380″
socket.rxBufSize=”87380″
socket.performanceConnectionTime=”2″
socket.performanceLatency=”0″
socket.performanceBandwidth=”1″
server=”My server”

Can anyone help me please? Thank you

Try this:
[code type=java]
connector.setProperty(“useComet”, Boolean.toString(false));
connector.setProperty(“socket.appReadBufSize”, “87380”);
connector.setProperty(“socket.rxBufSize”, “87380”);
connector.setProperty(“socket.performanceConnectionTime”, “2”);
connector.setProperty(“socket.performanceLatency”, “0”);
connector.setProperty(“socket.performanceBandwidth”, “1”);
connector.setProperty(“server”, “My server”);