【问题标题】:Setting Atmosphere settings in Vaadin SpringBootApplication在 Vaadin SpringBootApplication 中设置 Atmosphere 设置
【发布时间】:2022-01-21 05:59:57
【问题描述】:

我在 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】:

    试试这样的

    @ManagedBean
    public class AtmosphereInitializer implements ServletContextInitializer {
    
        @Override
        public void onStartup(ServletContext servletContext) {
    servletContext.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads","2");
    servletContext.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool","true");
    ...
    
        }
    }
    

    【讨论】:

    • 我与 WebApplicationInitializer 一起实现了这个,它似乎不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-29
    • 1970-01-01
    • 2022-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多