Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.14 KB

README.md

File metadata and controls

77 lines (55 loc) · 2.14 KB

CircleCI Quality Gate Status

Parse startup parameters

Features

  • supported types: int, String, File, boolean, char, long, Period, Duration, enums, BigDecimal
  • thread safe

Setup with dependency managers

Maven

<repositories>
    <repository>
        <id>pne</id>
        <name>payneteasy repo</name>
        <url>https://maven.pne.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.payneteasy</groupId>
        <artifactId>startup-parameters</artifactId>
        <version>1.0-10</version>
    </dependency>
</dependencies>

Gradle

compile 'com.payneteasy:startup-parameters:1.0-10'

How to use

❶ Create an interface with parameters, see example

public interface IStartupConfig {

    @AStartupParameter(name = "WEB_SERVER_PORT", value = "8083")
    int webServerPort();

    @AStartupParameter(name = "WEB_SERVER_CONTEXT", value = "/api")
    String webServerContext();

    @AStartupParameter(name = "REQUEST_LOG_DIR", value = "./logs")
    File getRequestLogDir();
}

❷ Create an instance, see example

    IStartupConfig startupConfig = StartupParametersFactory.getStartupParameters(IStartupConfig.class);
    int port = startupConfig.webServerPort();

Pretty log

SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();

License

The Startup Parameters library is licensed under the Apache License 2.0