Using Spring Boot Properties
Flowable applications are Spring Boot 2.1 applications and they are configured like a typical Spring Boot application. In this guide, we are going to explain a small subset of the possibilities, to understand more please read the Spring Boot Externalized Configuration.
Spring Boot allows a sensible way of overriding properties. The following is a subset of the ordering:
-
Command line arguments (if running with
java -jar application.jar
). -
JNDI attributes from
java:comp/env
. -
Java System properties (
System.getProperties()
). -
OS environment variables.
-
Profile-specific application properties outside of your packaged jar (
application-{profile}.properties
and YAML variants). -
Profile-specific application properties packaged inside your jar (
application-{profile}.properties
and YAML variants). -
Application properties outside of your packaged jar (
application.properties
and YAML variants). -
Application properties packaged inside your jar (
application.properties
and YAML variants).
Application Property Files
A Spring Boot application loads properties from application.properties
files from the following locations:
-
A
/config
subdirectory of the current directory (if running withjava -jar application.jar
). -
The current directory (if running with
java -jar application.jar
). -
A classpath
/config
package. -
The classpath root.
Properties defined in locations higher in the list have a higher priority.
It is also possible to define additional locations for the configuration
files by defining the spring.config.additional-location
property.
The locations specified are used in addition to the default locations
and have a higher priority.
This priority of the configuration lets you specify default values in one
configuration file and then selectively override those values in another.
You can provide default values for your application in application.properties
in one of the default locations.
These default values can then be overridden at runtime with a different file
located in one of the custom locations.
Relaxed Binding
Spring Boot uses some relaxed rules for binding Environment
properties to
@ConfigurationProperties
beans, so there does not need to be an exact match
between the Environment property name and the bean property name.
Typical examples where this is useful include dash-separated environment
properties (for example, context-path
binds to contextPath
),
and capitalized environment properties (for example, PORT
binds to port
).
Defining Properties for a Prebuilt Flowable WAR
If you are using a prebuilt Flowable WAR application (i.e., not building your own WAR) then you have different options to provide custom properties to the application.