Class SwingBridgeAutoConfiguration

java.lang.Object
vaadinx.swing.app.spring.SwingBridgeAutoConfiguration

@AutoConfiguration(before=com.vaadin.flow.spring.SpringBootAutoConfiguration.class) public class SwingBridgeAutoConfiguration extends Object
Wires a Spring Boot app for SB-Emulators, so a migrated app's host app carries **no** servlet, no servlet registration and no bootstrap bean of its own. Discovered through META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports; nothing has to be imported or scanned.

This is the one place in SB-Emulators that self-registers, under R_no_spi_selfregister's framework-dedicated-module exception. Its three limbs are what the class is shaped by: this module exists only for Spring, registration goes through Spring's own discovery rather than META-INF/services (which is precisely what conflicts with Spring's bean discovery), and every bean below is ConditionalOnMissingBean, so an app that declares its own still wins. See D_library_servlet.

Ordered before Vaadin's own SpringBootAutoConfiguration: its servlet registration is itself @ConditionalOnMissingBean, so registering first is what makes it back off in favour of ours.

  • Constructor Summary

    Constructors
    Constructor
    Description
    SwingBridgeAutoConfiguration(org.springframework.core.env.Environment environment)
    Refuses a deployment that serves Vaadin requests on virtual threads (R_match_swing_errors case (10), D_virtual_request_threads) at context refresh — the earliest knowable moment, and reachable only from a Spring-aware component because the switch is a Spring property.
  • Method Summary

    Modifier and Type
    Method
    Description
    vaadinx.swing.app.SwingBridgeEmulatorsBootstrap
    The single mandatory init listener, which a Spring app would otherwise have to declare as a bean itself — the class is final, so it is not the app's to annotate, and forgetting it is what MainWindowRoute throws about on attach (R_match_swing_errors case (5), M1D_bootstrap_canonical).
    org.springframework.boot.web.servlet.ServletRegistrationBean<com.vaadin.flow.spring.SpringServlet>
    swingBridgeServletRegistration(org.springframework.beans.factory.ObjectProvider<jakarta.servlet.MultipartConfigElement> multipartConfig, com.vaadin.flow.spring.VaadinConfigurationProperties configurationProperties, org.springframework.context.ApplicationContext context)
    Replaces the servlet registration Vaadin's own auto-configuration would publish, with one whose servlet wraps the session lock.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SwingBridgeAutoConfiguration

      public SwingBridgeAutoConfiguration(org.springframework.core.env.Environment environment)
      Refuses a deployment that serves Vaadin requests on virtual threads (R_match_swing_errors case (10), D_virtual_request_threads) at context refresh — the earliest knowable moment, and reachable only from a Spring-aware component because the switch is a Spring property.

      Without this the refusal comes only at the first peer→Swing callback, from callSwing: the loom runner supports platform request threads only, and the deployment is wrong from startup on.

  • Method Details

    • swingBridgeServletRegistration

      @Bean @ConditionalOnMissingBean(value=com.vaadin.flow.spring.SpringServlet.class, parameterizedContainer=org.springframework.boot.web.servlet.ServletRegistrationBean.class) public org.springframework.boot.web.servlet.ServletRegistrationBean<com.vaadin.flow.spring.SpringServlet> swingBridgeServletRegistration(org.springframework.beans.factory.ObjectProvider<jakarta.servlet.MultipartConfigElement> multipartConfig, com.vaadin.flow.spring.VaadinConfigurationProperties configurationProperties, org.springframework.context.ApplicationContext context)
      Replaces the servlet registration Vaadin's own auto-configuration would publish, with one whose servlet wraps the session lock.

      Built through SpringBootAutoConfiguration.configureServletRegistrationBean(ObjectProvider, VaadinConfigurationProperties, SpringServlet) rather than by hand: that method computes the mappings, init parameters and Push URL, and the Atmosphere JSR-356 mapping is one of them — lose it and Push breaks, which breaks every blocking dialog, with no error anywhere.

    • swingBridgeEmulatorsBootstrap

      @Bean @ConditionalOnMissingBean public vaadinx.swing.app.SwingBridgeEmulatorsBootstrap swingBridgeEmulatorsBootstrap()
      The single mandatory init listener, which a Spring app would otherwise have to declare as a bean itself — the class is final, so it is not the app's to annotate, and forgetting it is what MainWindowRoute throws about on attach (R_match_swing_errors case (5), M1D_bootstrap_canonical). Published here, that failure mode stops existing on this lane.