SpringApplicationJsonEnvironmentPostProcessor class final

Reads properties given as one JSON document, in the SPRING_APPLICATION_JSON environment variable or the spring.application.json property.

Some platforms make it easier to pass one JSON value than many separate variables. SpringApplication always runs this post-processor, before the config files are read, so applications never create it; they only set the variable.

Nested objects become dotted names and arrays indexed names: {"app": {"hosts": ["a"]}} is app.hosts[0]=a. The resulting property source goes right above the OS environment variables, below the command line and the --dart-define values. The JSON comes from the first property source that has either name. JSON that cannot be parsed, or that is not an object, fails the start with a StateError.

SPRING_APPLICATION_JSON='{"server":{"port":9090}}' dart run
dart run bin/main.dart --spring.application.json='{"app":{"hosts":["a","b"]}}'

Spring (Java): SpringApplicationJsonEnvironmentPostProcessor, with the same names.

Implemented types

Constructors

SpringApplicationJsonEnvironmentPostProcessor()
The post-processor; it has no settings.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
order → int
Where this object goes: lower values come first. Values are usually small numbers, or offsets from highestPrecedence and lowestPrecedence.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) → void
Changes environment, the environment being prepared for application.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

propertySourceName → const String
The name of the property source the JSON properties are put in.
springApplicationJsonEnvironmentVariable → const String
The environment variable that can hold the JSON, SPRING_APPLICATION_JSON.
springApplicationJsonProperty → const String
The property that can hold the JSON, spring.application.json.