Class SpringLookupInitializer

java.lang.Object
com.vaadin.flow.di.LookupInitializer
com.vaadin.flow.spring.SpringLookupInitializer
All Implemented Interfaces:
AbstractLookupInitializer
Direct Known Subclasses:
UITestSpringLookupInitializer

public class SpringLookupInitializer extends LookupInitializer
Spring aware LookupInitializer implementation.
Since:
Author:
Vaadin Ltd
  • Constructor Details

    • SpringLookupInitializer

      public SpringLookupInitializer()
  • Method Details

    • 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 LookupInitializer
      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
    • createLookup

      protected Lookup createLookup(VaadinContext context, Map<Class<?>,Collection<Class<?>>> services)
      Description copied from class: LookupInitializer
      Creates a lookup based on provided services.
      Overrides:
      createLookup in class LookupInitializer
      Parameters:
      context - a Vaadin context to create a lookup for
      services - the service objects mapped to the service type to create a lookup
      Returns:
      the lookup instance created with provided services