servletWebServerFactory made lazy to run as web application

This commit is contained in:
Matteo Steccolini
2023-12-18 09:07:59 +01:00
parent f9ce228adc
commit eafa7cfb4c

View File

@@ -28,6 +28,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
@@ -72,6 +73,7 @@ public class Application extends SpringBootServletInitializer {
} }
@Bean @Bean
@Lazy
public ServletWebServerFactory servletWebServerFactory() { public ServletWebServerFactory servletWebServerFactory() {
return new JettyServletWebServerFactory(); return new JettyServletWebServerFactory();
} }