package com.techempower.spring;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@ComponentScan
@EnableAutoConfiguration(exclude = {WebMvcAutoConfiguration.class})
@EnableWebMvc
public class SampleApplication extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(SampleApplication.class);
	}

	public static void main(String[] args) throws Exception {
		new SpringApplicationBuilder(SampleApplication.class).run(args);
	}

}
@@ -26,16 +26,107 @@
 pring;%0A%0A
+import io.undertow.Undertow;%0Aimport io.undertow.UndertowOptions;%0Aimport org.xnio.Options;%0A%0A
 import o
@@ -325,24 +325,208 @@
 ionBuilder;%0A
+import org.springframework.boot.context.embedded.undertow.UndertowBuilderCustomizer;%0Aimport org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;%0A
 import org.s
@@ -583,24 +583,76 @@
 nitializer;%0A
+import org.springframework.context.annotation.Bean;%0A
 import org.s
@@ -1226,9 +1226,679 @@
 s);%0A%09%7D%0A%0A
+%09@Bean%0A%09public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() %7B%0A%09%09UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();%0A%09%09factory.addBuilderCustomizers(new UndertowBuilderCustomizer() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void customize(Undertow.Builder builder) %7B%0A%09%09%09%09builder.setBufferSize(1024 * 16)%0A%09%09%09%09%09%09.setIoThreads(Runtime.getRuntime().availableProcessors() * 2)%0A%09%09%09%09%09%09.setSocketOption(Options.BACKLOG, 10000)%0A%09%09%09%09%09%09.setServerOption(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, false)%0A%09%09%09%09%09%09.setServerOption(UndertowOptions.ALWAYS_SET_DATE, true)%0A%09%09%09%09%09%09.setWorkerThreads(200);%0A%09%09%09%7D%0A%0A%09%09%7D);%0A%09%09return factory;%0A%09%7D%0A%0A
 %7D

Add Undertow Customizer