Developing Java Applications with Spring and Spring Boot
by Claudio Eduardo de Oliveira, Greg L. Turnquist, Alex Antonov
How it works...
Just like every other configuration approach we have looked at, the JSON content is consumed by a dedicated EnvironmentPostProcessor implementation. The only difference is the flattening of the JSON tree into a flat property map, to match the dot-separated properties naming style. In our case, the my->config->value nested map gets converted into a flat map with only one key, my.config.value, with the value of From external JSON.
The setting of the JSON content can come from ANY property source, available from the environment at the time of loading, which contains a key named spring.application.json with a value of valid JSON content, and is not only limited to being set by an Environment Variable or using the SPRING_APPLICATION_JSON ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access