Class SpringBridge

java.lang.Object
com.vaadin.copilot.SpringBridge

public class SpringBridge extends Object
Acts as a bridge between Copilot and Spring specific API. Can be imported into copilot and must never itself import Spring classes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Class<?>
    getApplicationClass(com.vaadin.flow.server.VaadinServletContext context)
    Returns the Spring Boot application class of the given context.
    getEndpoints(com.vaadin.flow.server.VaadinServletContext context)
    Gets a list of all endpoints / browser callables in the application.
    static String
    getPropertyValue(com.vaadin.flow.server.VaadinServletContext context, String property)
    Returns the value of the given property from the Spring environment of the given context.
    static String
    getUrlPrefix(com.vaadin.flow.server.VaadinServletContext context)
    Gets the prefix used for all route paths in the application
    static boolean
    Returns whether Spring is available in the classpath.
    static boolean
    isViewSecurityEnabled(com.vaadin.flow.server.VaadinServletContext context)
    Returns whether Spring Security is enabled in the given context.

    Methods inherited from class java.lang.Object

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

    • SpringBridge

      public SpringBridge()
  • Method Details

    • isSpringAvailable

      public static boolean isSpringAvailable()
      Returns whether Spring is available in the classpath.
      Returns:
      true if Spring is available, false otherwise
    • getPropertyValue

      public static String getPropertyValue(com.vaadin.flow.server.VaadinServletContext context, String property)
      Returns the value of the given property from the Spring environment of the given context.
      Parameters:
      context - the Vaadin servlet context
      property - the property name
      Returns:
      the property value or null if not found
    • getApplicationClass

      public static Class<?> getApplicationClass(com.vaadin.flow.server.VaadinServletContext context)
      Returns the Spring Boot application class of the given context.
      Parameters:
      context - the Vaadin servlet context
      Returns:
      the Spring Boot application class or null if not found
    • isViewSecurityEnabled

      public static boolean isViewSecurityEnabled(com.vaadin.flow.server.VaadinServletContext context)
      Returns whether Spring Security is enabled in the given context.
      Parameters:
      context - the Vaadin servlet context
      Returns:
      true if Spring Security is enabled, false otherwise
    • getUrlPrefix

      public static String getUrlPrefix(com.vaadin.flow.server.VaadinServletContext context)
      Gets the prefix used for all route paths in the application
      Parameters:
      context - the Vaadin servlet context
      Returns:
      the prefix used for all route paths in the application, never ending in a "/" or an empty string if no prefix is used
    • getEndpoints

      public static List<SpringBridge.EndpointInfo> getEndpoints(com.vaadin.flow.server.VaadinServletContext context)
      Gets a list of all endpoints / browser callables in the application.
      Returns:
      a list of endpoint info objects