在 Vaadin SpringBootApplication 中设置氛围设置

问题描述 投票:0回答:1

我在 Spring Boot 应用程序中使用 JDK17 和 Vaadin 22 (Flow)。我希望设置 Tomcat 使用的气氛设置。

我已尝试以下操作,但它没有设置值:

@SpringBootApplication
@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
@Theme(value = "sample")
@PWA(name = "sample", offlineResources = {"images/logo.png"})
@Push(PushMode.AUTOMATIC)
@WebServlet(name = "springServlet", urlPatterns = "/* ", asyncSupported = true, initParams = {
        @WebInitParam(name = "org.atmosphere.cpr.broadcaster.shareableThreadPool", value = "true"),
        @WebInitParam(name = "org.atmosphere.cpr.broadcaster.maxProcessingThreads", value = "2"),
        @WebInitParam(name = "org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", value = "2"),
        @WebInitParam(name = "org.atmosphere.cpr.maxSchedulerThread", value = "2")
})
public class Application extends SpringBootServletInitializer implements AppShellConfigurator {
    public static void main(String @NotNull [] args) {
        SpringApplication.run(Application.class,
                              args);
    }
} 
spring-boot tomcat vaadin atmosphere vaadin22
1个回答
1
投票

尝试这样的事情

        @ManagedBean
        public class AtmosphereInitializer implements ServletContextInitializer {        
            @Override
            public void onStartup(ServletContext servletContext) {
servletContext.setInitParameter("org.atmosphere.cpr.AtmosphereConfig.getInitParameter","true"); servletContext.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads","2"); servletContext.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool","true");
        ...
            }
        }
© www.soinside.com 2019 - 2024. All rights reserved.