Class SpringBootServiceFactory
java.lang.Object
com.gigaspaces.internal.services.ServiceFactory
com.gigaspaces.internal.services.SpringBootServiceFactory
- Direct Known Subclasses:
DiManagerServiceFactory, GraphqlServiceFactory, McpServiceFactory, RestV3ServiceFactory
Common base for
ServiceFactory implementations that boot an in-process, embedded Spring
Boot fat-jar application via reflection over org.springframework.boot.loader.launch.*
(currently McpServiceFactory and RestV3ServiceFactory; GraphqlServiceFactory
once re-enabled). Extracted from what was, before PIC-6253, near-identical duplicated code in
each of those classes.
The single behavioral change this base class makes versus the pre-PIC-6253 per-class copies:
each service's ChildFirstURLClassLoader is now parented on the shared
SpringBootClassLoader singleton instead of directly on the thread's context classloader
(which, in practice, was always the plain system classloader - see ServiceFactory.createService()).
This lets the shared library layer's classes resolve via ordinary parent-first delegation, while
ChildFirstURLClassLoader's existing child-first override (scoped to
org.springframework.boot.loader.*) continues to guarantee each service's own bundled
Launcher/JarLauncher wins over anything above it.
- Since:
- 18.0.0
- Author:
- Niv Ingberg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]Arguments passed to Spring Boot'sLauncher.launch(String[]); empty by default.final Closeableprotected abstract PathPath to this service's own Spring Boot fat jar.protected final Stringprotected voidinitializeClasspath(ClasspathBuilder classpath) protected abstract org.slf4j.Loggerlogger()Logger used for the "service terminated" message on shutdown.protected ClassLoaderParent classloader for this service'sChildFirstURLClassLoader.Methods inherited from class ServiceFactory
getServiceName, startService, toString
-
Constructor Details
-
SpringBootServiceFactory
public SpringBootServiceFactory()
-
-
Method Details
-
getBootJarPath
Path to this service's own Spring Boot fat jar. -
buildLaunchArgs
Arguments passed to Spring Boot'sLauncher.launch(String[]); empty by default. -
logger
protected abstract org.slf4j.Logger logger()Logger used for the "service terminated" message on shutdown. -
parentClassLoader
Parent classloader for this service'sChildFirstURLClassLoader. Defaults to the sharedSpringBootClassLoadersingleton (PIC-6253), so the shared library layer's classes resolve via ordinary parent-first delegation. A service whose own fat jar bundles its complete stack and gets no benefit from that layer may override this to returnClassLoader.getSystemClassLoader()instead for full isolation from the shared layer - seeDiManagerServiceFactory's own override for the tradeoffs this carries (logging-system auto-detection in particular). -
getServiceClassName
- Specified by:
getServiceClassNamein classServiceFactory
-
initializeClasspath
- Specified by:
initializeClasspathin classServiceFactory
-
createService
- Overrides:
createServicein classServiceFactory
-