- supported types: int, String, File, boolean, char, long, Period, Duration, enums, BigDecimal
- thread safe
<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>
compile 'com.payneteasy:startup-parameters:1.0-10'
❶ 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();
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
The Startup Parameters library is licensed under the Apache License 2.0