com.vaadin.flow.spring.

Class SpringVaadinServletService

All Implemented Interfaces:

Serializable

Direct Known Subclasses:

MockSpringServletService

public class SpringVaadinServletService extends VaadinServletService

Spring application context aware Vaadin servlet service implementation.

Author:

Vaadin Ltd

See Also:

  • Constructor Details

    • SpringVaadinServletService

      public SpringVaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, org.springframework.context.ApplicationContext context)

      Creates an instance connected to the given servlet and using the given configuration with provided application context.

      Parameters:

      servlet - the servlet which receives requests

      deploymentConfiguration - the configuration to use

      context - the Spring application context

  • Method Details

    • loadInstantiators

      protected Optional<Instantiator> loadInstantiators() throws ServiceException

      Description copied from class: VaadinService

      Loads and initializes instantiators.

      A custom Vaadin service implementation can override this method to pick an instantiator in some other way instead of the default implementation that uses ServiceLoader.

      There may be only one applicable instantiator. Otherwise ServiceException will be thrown.

      Overrides:

      loadInstantiators in class VaadinService

      Returns:

      an optional instantator, or an empty optional if no instantiator found

      Throws:

      ServiceException - if there are multiple applicable instantiators

      See Also:

    • createDefaultExecutor

      protected Executor createDefaultExecutor()

      Description copied from class: VaadinService

      Creates a default executor instance to use with this service.

      This default implementation creates a thread pool executor with a custom thread factory to generate daemon threads. It uses a core pool size of 8, an unbounded maximum pool size, and a keep-alive time of 60 seconds for idle threads. The thread pool grows dynamically as required, and idle core threads are allowed to time out.

      A custom VaadinService implementation can override this method to provide its own ad-hoc executor tailored to specific environments like CDI or Spring.

      Implementors should never return null; if an executor instance cannot be provided, the method should call super.createDefaultExecutor().

      The application can provide a more appropriate executor implementation through a VaadinServiceInitListener and calling ServiceInitEvent.setExecutor(Executor).

      Overrides:

      createDefaultExecutor in class VaadinService

      Returns:

      a default executor instance to use, never null.

      See Also:

    • init

      public void init() throws ServiceException

      Description copied from class: VaadinService

      Initializes this service. The service should be initialized before it is used.

      Overrides:

      init in class VaadinService

      Throws:

      ServiceException - if a problem occurs when creating the service

    • createVaadinSession

      protected VaadinSession createVaadinSession(VaadinRequest request)

      Description copied from class: VaadinService

      Creates a new Vaadin session for this service and request.

      Overrides:

      createVaadinSession in class VaadinService

      Parameters:

      request - The request for which to create a VaadinSession

      Returns:

      A new VaadinSession

    • getStaticResource

      public URL getStaticResource(String path)

      Description copied from class: VaadinService

      Returns a URL to the static resource at the given URI or null if no file found.

      Overrides:

      getStaticResource in class VaadinServletService

      Parameters:

      path - the URL for the resource

      Returns:

      the resource located at the named path, or null if there is no resource at that path