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
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.boot.web.servlet.ServletRegistrationBean
<?> Filter.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
<?> Filter.static void
destroy()
Calls all registered listeners on exit.static com.google.inject.Module[]
Returns the list of core modules.static List
<com.erudika.para.core.rest.CustomResourceHandler> Try loading externalCustomResourceHandler
classes.static <T> T
getInstance
(Class<T> type) Return an instance of some class if it has been wired through DI.int
getOrder()
org.springframework.boot.web.servlet.FilterRegistrationBean
<?> Filter.static void
initialize
(com.google.inject.Module... modules) Initializes the Para core modules and allows the user to override them.static void
injectInto
(Object obj) Inject dependencies into a given object.org.springframework.boot.web.servlet.server.ServletWebServerFactory
Jetty config.static void
Para starts from here.void
Called before shutdown.Methods inherited from class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
onStartup
-
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 callsPara.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 callsPara.destroy()
. -
injectInto
Inject dependencies into a given object.- Parameters:
obj
- the object we inject into
-
getInstance
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
Try loading externalCustomResourceHandler
classes. These will handle custom API requests. viaServiceLoader.load(java.lang.Class)
.- Returns:
- a loaded list of ServletContextListener class.
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
apiV1RegistrationBean
@Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<?> apiV1RegistrationBean()Filter.- Returns:
- API servlet bean
-
gzipFilterRegistrationBean
@Bean public org.springframework.boot.web.servlet.FilterRegistrationBean<?> gzipFilterRegistrationBean()Filter.- Returns:
- GZIP filter bean
-
corsFilterRegistrationBean
@Bean public org.springframework.boot.web.servlet.FilterRegistrationBean<?> corsFilterRegistrationBean()Filter.- Returns:
- CORS filter bean
-
jettyConfigBean
@Bean public org.springframework.boot.web.servlet.server.ServletWebServerFactory jettyConfigBean()Jetty config.- 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 builderisWar
- is it started from a WAR filesources
- the application classes that will be scanned- Returns:
- the application builder
-
main
-