All Projects → qatools → Properties

qatools / Properties

Licence: apache-2.0
This library provides convinient way to work with properties. It can handle property-files on hard drive, in classpath or get values from system properties

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Properties

Konfig
Simple config properties API for Kotlin
Stars: ✭ 249 (+408.16%)
Mutual labels:  environment-variables, properties
Environ
Library for managing environment variables in Clojure
Stars: ✭ 855 (+1644.9%)
Mutual labels:  environment-variables
Dotenv Kotlin
🗝️ Dotenv is a module that loads environment variables from a .env file
Stars: ✭ 326 (+565.31%)
Mutual labels:  environment-variables
Sonar Jproperties Plugin
SonarQube Java Properties Analyzer
Stars: ✭ 5 (-89.8%)
Mutual labels:  properties
Envied
Ensures presence and type of your app's ENV-variables (mirror)
Stars: ✭ 327 (+567.35%)
Mutual labels:  environment-variables
Go Envparser
a go generator based env to go-struct decoder.
Stars: ✭ 17 (-65.31%)
Mutual labels:  environment-variables
I18n Editor
GUI for editing your i18n translation files
Stars: ✭ 290 (+491.84%)
Mutual labels:  properties
Env Cmd
Setting environment variables from a file
Stars: ✭ 969 (+1877.55%)
Mutual labels:  environment-variables
Dotenv sekrets
Seamlessly encrypt/decrypt/edit your rails Dotenv files with the help of the Sekrets gem
Stars: ✭ 25 (-48.98%)
Mutual labels:  environment-variables
Environs
simplified environment variable parsing
Stars: ✭ 631 (+1187.76%)
Mutual labels:  environment-variables
Node Config
Node.js Application Configuration
Stars: ✭ 5,423 (+10967.35%)
Mutual labels:  properties
Psl
PHP Standard Library - a modern, consistent, centralized, well-typed set of APIs for PHP programmers.
Stars: ✭ 329 (+571.43%)
Mutual labels:  environment-variables
Parameterhandler
Composer script handling your ignored parameter file
Stars: ✭ 906 (+1748.98%)
Mutual labels:  environment-variables
Babel Plugin React Remove Properties
Babel plugin for removing React properties. 💨
Stars: ✭ 327 (+567.35%)
Mutual labels:  properties
Ionic2 Environment Variables
Demonstration on how to easily setup environment variables in Ionic 2
Stars: ✭ 20 (-59.18%)
Mutual labels:  environment-variables
Docsify Themeable
A delightfully simple theme system for docsify.js. Features multiple themes with rich customization options, an improved desktop and mobile experience, and legacy browser support (IE10+).
Stars: ✭ 299 (+510.2%)
Mutual labels:  properties
Dotenv Flow
Loads environment variables from .env.[development|test|production][.local] files for Node.js® projects.
Stars: ✭ 537 (+995.92%)
Mutual labels:  environment-variables
Musthave
A Node.js helper module for checking object elements against a list of required elements.
Stars: ✭ 5 (-89.8%)
Mutual labels:  environment-variables
Dotenv Webpack
A secure webpack plugin that supports dotenv and other environment variables and only exposes what you choose and use.
Stars: ✭ 1,022 (+1985.71%)
Mutual labels:  environment-variables
Mconfig
MCONFIG is a lightweight Golang library for integrating configs files like (json, yml, toml) and environment variables into one config struct.
Stars: ✭ 28 (-42.86%)
Mutual labels:  environment-variables

QATools Properties

release Maven Central build covarage

This library provides convenient way to work with properties. It can handle property-files on hard drive, in classpath or get values from system properties.

Deprecation notice

This library is not actively maintained, so please look at the same libs

Getting started

To add Properties to your Java project, put the following in the dependencies section of your POM:

Latest stable version:

<dependency>
    <groupId>ru.qatools.commons</groupId>
    <artifactId>properties</artifactId>
    <version>${LATEST_VERSION}</version>
</dependency>

Now you are ready to describe you configuration:

public interface MyConfig {

    @Property("proxy.port")
    int getPort();

    @Property("proxy.host")
    String getHost();

}

Then you need to populate the configuration:

MyConfig config = PropertyLoader.newInstance()
        .populate(MyConfig.class);

By default values proxy.port and proxy.host will be read from system properties. If you want to read properties from file you can use @Resource annotation:

@Resource.Classpath("proxy.properties")
public interface MyConfig {

    @Property("proxy.port")
    int getPort();

    @Property("proxy.host")
    String getHost();

}

There is a few available options:

  • @Resource.Classpath finds properties file by given name in your classpath.
  • @Resource.File finds properties file by given file path.

Put in your resources directory (mainly it src/main/resources) file proxy.properties

proxy.host=proxy.yandex.ru
proxy.port=3133

It's easy to override value from system properties. E.g. when you run your code with

-Dproxy.host=ya.ru

it overrides the default value in properties file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].