Class SpringBrowserlessApplicationContext

java.lang.Object
com.vaadin.browserless.SpringBrowserlessApplicationContext

public final class SpringBrowserlessApplicationContext extends Object
Factory for creating a Spring-integrated BrowserlessApplicationContext.

Wires a Spring-aware servlet and the BrowserlessTestSpringLookupInitializer so the test context can reach Spring beans and lifecycle. Three entry points are provided:

 var app = SpringBrowserlessApplicationContext.createSecured(routes,
         springCtx);
 var admin = app.newUser("admin", "ADMIN");
 var window = admin.newWindow();
 window.navigate(ProtectedView.class);
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.vaadin.browserless.BrowserlessApplicationContext.Builder
    builder(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
    Creates a Spring-pre-wired builder.
    static com.vaadin.browserless.BrowserlessApplicationContext.Builder
    builder(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
    Creates a Spring-pre-wired builder with a custom UI factory.
    static com.vaadin.browserless.BrowserlessApplicationContext
    create(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
    Creates an unsecured Spring-integrated application context.
    static com.vaadin.browserless.BrowserlessApplicationContext
    create(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
    Creates an unsecured Spring-integrated application context with a custom UI factory.
    static com.vaadin.browserless.SecuredBrowserlessApplicationContext<org.springframework.security.core.Authentication>
    createSecured(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
    Creates a Spring-integrated application context with Spring Security wiring.
    static com.vaadin.browserless.SecuredBrowserlessApplicationContext<org.springframework.security.core.Authentication>
    createSecured(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
    Creates a secured Spring-integrated application context with a custom UI factory.

    Methods inherited from class java.lang.Object

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

    • builder

      public static com.vaadin.browserless.BrowserlessApplicationContext.Builder builder(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
      Creates a Spring-pre-wired builder. The builder has the Spring servlet, the lookup initializer and the lookup-initializer close hook configured; callers can chain additional customizations before calling BrowserlessApplicationContext.Builder.build().
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      Returns:
      a pre-wired builder
    • builder

      public static com.vaadin.browserless.BrowserlessApplicationContext.Builder builder(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
      Creates a Spring-pre-wired builder with a custom UI factory.
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      uiFactory - the UI factory
      Returns:
      a pre-wired builder
    • create

      public static com.vaadin.browserless.BrowserlessApplicationContext create(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
      Creates an unsecured Spring-integrated application context.
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      Returns:
      a new unsecured application context configured for Spring
    • create

      public static com.vaadin.browserless.BrowserlessApplicationContext create(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
      Creates an unsecured Spring-integrated application context with a custom UI factory.
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      uiFactory - the UI factory
      Returns:
      a new unsecured application context configured for Spring
    • createSecured

      public static com.vaadin.browserless.SecuredBrowserlessApplicationContext<org.springframework.security.core.Authentication> createSecured(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext)
      Creates a Spring-integrated application context with Spring Security wiring. Requires Spring Security on the classpath; throws otherwise.
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      Returns:
      a new secured application context configured for Spring Security
      Throws:
      IllegalStateException - if Spring Security is not on the classpath
    • createSecured

      public static com.vaadin.browserless.SecuredBrowserlessApplicationContext<org.springframework.security.core.Authentication> createSecured(com.vaadin.browserless.internal.Routes routes, org.springframework.context.ApplicationContext applicationContext, com.vaadin.browserless.internal.UIFactory uiFactory)
      Creates a secured Spring-integrated application context with a custom UI factory. Requires Spring Security on the classpath; throws otherwise.
      Parameters:
      routes - the discovered routes
      applicationContext - the Spring application context
      uiFactory - the UI factory
      Returns:
      a new secured application context configured for Spring Security
      Throws:
      IllegalStateException - if Spring Security is not on the classpath