Class ParaServer

java.lang.Object
com.erudika.para.server.ParaServer
All Implemented Interfaces:
org.springframework.core.Ordered

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The path of the API controller.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the main Para server bootstrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.boot.builder.SpringApplicationBuilder
    builder(org.springframework.boot.builder.SpringApplicationBuilder b, Class<?>... sources)
    This is the initializing method when running ParaServer as executable JAR (or WAR), from the command line: java -jar para.jar.
    static void
    Calls all registered listeners on exit.
    org.springframework.boot.web.error.ErrorPageRegistrar
    Registers custom error pages.
    int
     
    com.fasterxml.jackson.databind.ObjectMapper
    Configures a custom Jackson object mapper.
    static String
    loadResource(String filePath)
    Loads a file from classpath.
    static void
    main(String[] args)
    Para starts from here.
    void
    Called before shutdown.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ParaServer

      public ParaServer()
      Creates the main Para server bootstrapper.
  • Method Details

    • jacksonObjectMapper

      @Bean public com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper()
      Configures a custom Jackson object mapper.
      Returns:
      the ParaObjectUtils.getJsonMapper()
    • errorPageRegistrar

      @Bean public org.springframework.boot.web.error.ErrorPageRegistrar errorPageRegistrar()
      Registers custom error pages.
      Returns:
      Error page registry bean
    • loadResource

      public static String loadResource(String filePath)
      Loads a file from classpath.
      Parameters:
      filePath - a file path.
      Returns:
      file contents as a string
    • destroy

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

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

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

      public static org.springframework.boot.builder.SpringApplicationBuilder builder(org.springframework.boot.builder.SpringApplicationBuilder b, 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
      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