Class ParaServer

java.lang.Object
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
com.erudika.para.server.ParaServer
All Implemented Interfaces:
org.springframework.core.Ordered, org.springframework.web.WebApplicationInitializer

@SpringBootApplication public class ParaServer extends org.springframework.boot.web.servlet.support.SpringBootServletInitializer implements org.springframework.core.Ordered
Para modules are initialized and destroyed from here.
Author:
Alex Bogdanovski [[email protected]]
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.boot.web.servlet.ServletRegistrationBean<?>
     
    static org.springframework.boot.builder.SpringApplicationBuilder
    builder(org.springframework.boot.builder.SpringApplicationBuilder b, boolean isWar, Class<?>... sources)
    This is the initializing method when running ParaServer as executable JAR (or WAR), from the command line: java -jar para.jar.
    org.springframework.boot.web.servlet.FilterRegistrationBean<?>
     
    static void
    Calls all registered listeners on exit.
    static com.google.inject.Module[]
    Returns the list of core modules.
    Try loading external CustomResourceHandler classes.
    static <T> T
    getInstance(Class<T> type)
    Return an instance of some class if it has been wired through DI.
    int
     
    org.springframework.boot.web.servlet.FilterRegistrationBean<?>
     
    static void
    initialize(com.google.inject.Module... modules)
    Initializes the Para core modules and allows the user to override them.
    static void
    Inject dependencies into a given object.
    org.springframework.boot.web.servlet.server.ServletWebServerFactory
     
    static void
    main(String[] args)
    Para starts from here.
    void
    Called before shutdown.

    Methods inherited from class org.springframework.boot.web.servlet.support.SpringBootServletInitializer

    onStartup

    Methods inherited from class java.lang.Object

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

    • ParaServer

      public ParaServer()
  • Method Details

    • getCoreModules

      public static com.google.inject.Module[] getCoreModules()
      Returns the list of core modules.
      Returns:
      the core modules
    • initialize

      public static void initialize(com.google.inject.Module... modules)
      Initializes the Para core modules and allows the user to override them. Call this method first. This method calls Para.initialize().
      Parameters:
      modules - a list of modules that override the main modules
    • destroy

      public static void destroy()
      Calls all registered listeners on exit. Call this method last. This method calls Para.destroy().
    • injectInto

      public static void injectInto(Object obj)
      Inject dependencies into a given object.
      Parameters:
      obj - the object we inject into
    • getInstance

      public static <T> T getInstance(Class<T> type)
      Return an instance of some class if it has been wired through DI.
      Type Parameters:
      T - any type
      Parameters:
      type - any type
      Returns:
      an object
    • getCustomResourceHandlers

      public static List<CustomResourceHandler> getCustomResourceHandlers()
      Try loading external CustomResourceHandler classes. These will handle custom API requests. via ServiceLoader.load(java.lang.Class).
      Returns:
      a loaded list of ServletContextListener class.
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • apiV1RegistrationBean

      @Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<?> apiV1RegistrationBean()
      Returns:
      API servlet bean
    • gzipFilterRegistrationBean

      @Bean public org.springframework.boot.web.servlet.FilterRegistrationBean<?> gzipFilterRegistrationBean()
      Returns:
      GZIP filter bean
    • corsFilterRegistrationBean

      @Bean public org.springframework.boot.web.servlet.FilterRegistrationBean<?> corsFilterRegistrationBean()
      Returns:
      CORS filter bean
    • jettyConfigBean

      @Bean public org.springframework.boot.web.servlet.server.ServletWebServerFactory jettyConfigBean()
      Returns:
      Jetty config bean
    • preDestroy

      @PreDestroy public void preDestroy()
      Called before shutdown.
    • builder

      public static org.springframework.boot.builder.SpringApplicationBuilder builder(org.springframework.boot.builder.SpringApplicationBuilder b, boolean isWar, Class<?>... sources)
      This is the initializing method when running ParaServer as executable JAR (or WAR), from the command line: java -jar para.jar.
      Parameters:
      b - Spring app builder
      isWar - is it started from a WAR file
      sources - the application classes that will be scanned
      Returns:
      the application builder
    • main

      public static void main(String[] args)
      Para starts from here.
      Parameters:
      args - args