From db4ffbbc4b15babd02a6cb636abdef693dcc9622 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 13 Feb 2018 13:22:50 +0000 Subject: [PATCH] Expose constants for Spring application JSON property names Closes gh-12012 --- ...gApplicationJsonEnvironmentPostProcessor.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java index 75c345d3102..02f846b27c3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,6 +56,16 @@ import org.springframework.web.context.support.StandardServletEnvironment; public class SpringApplicationJsonEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { + /** + * Name of the {@code spring.application.json} property. + */ + public static String SPRING_APPLICATION_JSON_PROPERTY = "spring.application.json"; + + /** + * Name of the {@code SPRING_APPLICATION_JSON} environment variable. + */ + public static String SPRING_APPLICATION_JSON_ENVIRONMENT_VARIABLE = "SPRING_APPLICATION_JSON"; + private static final String SERVLET_ENVIRONMENT_CLASS = "org.springframework.web." + "context.support.StandardServletEnvironment"; @@ -179,8 +189,8 @@ public class SpringApplicationJsonEnvironmentPostProcessor private static class JsonPropertyValue { - private static final String[] CANDIDATES = { "spring.application.json", - "SPRING_APPLICATION_JSON" }; + private static final String[] CANDIDATES = { SPRING_APPLICATION_JSON_PROPERTY, + SPRING_APPLICATION_JSON_ENVIRONMENT_VARIABLE }; private final PropertySource propertySource;