AndHow!
Java application configuration
Last updated
Was this helpful?
Java application configuration
Last updated
Was this helpful?
New Release: 1.5.0, October 10, 2020 - notes.
This release jumps from 0.4.2 to 1.5.0, reflecting that AndHow has been in production long enough to be considered production ready, and includes some API changes. This release removes deprecated methods, clarifies / subtly changes some behavior, and has general improvements and bug fixes. See the full release notes.
AndHow configures your application with strongly typed Properties that work just like static final
constants in your code. Values for Properties are loaded from multiple sources and are validated at startup.
Strong Typing
Detailed validation
Simple to use and test
Use Java public
& private
modifiers to control Property value access
Validates all property values at startup to Fail Fast
Loads values from multiple sources (env. vars, system props, cmd line, prop files, JNDI, and more)
Generates configuration template files for the Properties in your application
Declaring Properties looks like this:
Using Properties looks like this:
StrProp
& IntProp
are AndHow Property
s. Properties and their values are constants, so they are always declared as static final
, but may be private
or any scope. Properties may have default values, validation rules, description, and more.
Properties are used just like static final constants with .getValue()
tacked on. They are strongly typed, so HOST.getValue()
returns a String
, PORT.getValue()
returns an Integer
.
At startup, AndHow scans System.Properties, environment variables, JNDI values, the andhow.properties file, etc., in a well established order. If the loaded value for any Property in the application does not meet the validation requirements, AndHow throws a detailed RuntimeException
to fail fast and prevent the application from running with invalid configuration.
Live-Code Quickstart will get you started with AndHow right in the browser window.
&?!