Search in sources :

Example 1 with JsonParser

use of org.springframework.boot.json.JsonParser in project spring-boot by spring-projects.

the class SpringApplicationJsonEnvironmentPostProcessor method processJson.

private void processJson(ConfigurableEnvironment environment, String json) {
    try {
        JsonParser parser = JsonParserFactory.getJsonParser();
        Map<String, Object> map = parser.parseMap(json);
        if (!map.isEmpty()) {
            addJsonPropertySource(environment, new MapPropertySource("spring.application.json", flatten(map)));
        }
    } catch (Exception ex) {
        logger.warn("Cannot parse JSON for spring.application.json: " + json, ex);
    }
}
Also used : MapPropertySource(org.springframework.core.env.MapPropertySource) JsonParser(org.springframework.boot.json.JsonParser)

Aggregations

JsonParser (org.springframework.boot.json.JsonParser)1 MapPropertySource (org.springframework.core.env.MapPropertySource)1