Expose constants for Spring application JSON property names

Closes gh-12012
This commit is contained in:
Andy Wilkinson 2018-02-13 13:22:50 +00:00
parent ce9b2b8266
commit db4ffbbc4b
1 changed files with 13 additions and 3 deletions

View File

@ -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;