Class UITestSpringLookupInitializer

All Implemented Interfaces:
AbstractLookupInitializer, org.springframework.test.context.TestExecutionListener

public class UITestSpringLookupInitializer extends SpringLookupInitializer implements org.springframework.test.context.TestExecutionListener
A SpringLookupInitializer that adapts Spring ApplicationContext to WebApplicationContext and registers it into ServletContext so that lookup can be initialized correctly. For internal use only.
  • Constructor Details

    • UITestSpringLookupInitializer

      public UITestSpringLookupInitializer()
  • Method Details

    • beforeTestMethod

      public void beforeTestMethod(org.springframework.test.context.TestContext testContext) throws Exception
      Specified by:
      beforeTestMethod in interface org.springframework.test.context.TestExecutionListener
      Throws:
      Exception
    • afterTestMethod

      public void afterTestMethod(org.springframework.test.context.TestContext testContext) throws Exception
      Specified by:
      afterTestMethod in interface org.springframework.test.context.TestExecutionListener
      Throws:
      Exception
    • initialize

      public void initialize(VaadinContext context, Map<Class<?>,Collection<Class<?>>> services, VaadinApplicationInitializationBootstrap bootstrap) throws jakarta.servlet.ServletException
      Description copied from interface: AbstractLookupInitializer
      Creates a new Lookup instance, initializes it and passes it to the provided bootstrap.

      The method should creates a new initialized Lookup instance. In some cases it's not possible to create the instance right away when the method is called. To be able to support this usecase the method contract doesn't require to return the Lookup instance. Instead the created instance should be passed to the provided bootstrap consumer once the instance is created and completely initialized. The bootstrap will start the application initialization which otherwise is postponed until a Lookup becomes available.

      The implementation must use the provided bootstrap to pass the Lookup instance otherwise the web application based on this LookupInitializer will never be bootstrapped.

      The provided services map contains service implementations found in application classpath using @HandlesTypes annotation declared for LookupServletContainerInitializer.

      Specified by:
      initialize in interface AbstractLookupInitializer
      Overrides:
      initialize in class SpringLookupInitializer
      Parameters:
      context - a Vaadin context to run initialization for
      services - the map of internal services with their implementations found in the application classpath
      bootstrap - the web application bootstrap
      Throws:
      jakarta.servlet.ServletException - if initialization failed