This repo contains base functionality for the service API. It is a collection of fundamental subsystems and tools to be used as the basis of any app or microservice. It includes:
- A subsystem that bootstraps application configuration based on properties
- A subsystem that prepares and logs fundamental information useful for 3rd line support
- Utilities to help with command line arguments, properties and starting a process
- Small dependency footprint consisting of a service API and a logging API
- Extensively tested
In the docs you will find examples of how to use this library.
This project uses a Java language specification version 17, it is compatible with Java 17 and higher.
This project is in maven central, to start using it just add this dependency to your POM.
<dependency>
<groupId>com.webotech</groupId>
<artifactId>service-base</artifactId>
<version>0.0.8</version>
</dependency>
or this dependency in gradle
implementation 'com.webotech:service-base:0.0.8'
Please use the latest version available in maven central - the version in this page may be old.
- Create a service class that extends
AbstractAppService<BasicAppContext>
- Use
ServiceUtil
to provide aBasicAppContext
equipped with recommended Subsystems - The service needs a main method that uses
ServiceUtil
to start it
public class ExampleApp extends AbstractAppService<BasicAppContext> {
ExampleApp(String[] args) {
super(ServiceUtil.equipBasicContext("ExampleApp", args));
}
public static void main(String[] args) {
ServiceUtil.startService(new ExampleApp(args));
}
}