Skip to content

ArtemGet/entrys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EO principles respected here

Build

Overview

Library designed for retrieving properties set at application startup. If you don't use Spring Framework/Spring Boot but like its configuration via yaml - you will find this library useful.

Advantages

  1. Lightweight, no need to pull lots of dependencies
  2. No reflection and typecasts
  3. Null safe and runtime exception free

Quick start

This library is distributed via jitpack.io

Supported entries

  1. Properties passed via -D
  2. Environment variables
  3. Json strings

Note that using json entries requires additional dependencies:

<dependency>
  <groupId>org.glassfish</groupId>
  <artifactId>jakarta.json</artifactId>
  <version>1.1.6</version>
</dependency>
  1. Yaml files

Note that using yaml entries requires additional dependencies:

<dependency>
   <groupId>com.amihaiemil.web</groupId>
   <artifactId>eo-yaml</artifactId>
   <version>8.0.6</version>
</dependency>

Examples

Properties:

String prop=new EProp("your_prop_passed_via_-D").value();

Environment variables:

String env=new EEnv("my_env").value()

Json strings:

TODO add docs

Yaml files:

  1. Works similar to spring framework @Value
  2. Supports string, number, arrays, float, boolean as value
  3. Supports default values and env injections
  4. Default yaml file config is placed under "src/main/resources/application.yaml", but is configurable
sex: "male"
person:
  name: "kekus"
  languages: [ ru,en ]
  age: ${AGE_ENV:123}

Getting attribute:

String sex=new EVal("sex").value();

Getting nested attribute:

String name=new EVal("person.name").value();

Getting array

List<String> languages=new ESplit(new EVal("person.languages")).value();

Getting env

String age=new EVal("person.age").value();
  1. If there is a default value and env is not present - will return default value
  2. If there is a default value and env is present - will return value from env
  3. If default value is not present - will return value from env

About

Library designed for retrieving properties set at application startup

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages