Remove spring.spel.ignore and spring.xml.ignore flags
This commit also removes ResourcePropertiesPersister which was introduced in 5.3 specifically for spring.xml.ignore flag and which is expected to be used only internally by Spring Framework. DefaultPropertiesPersister should be used instead. Closes gh-29277
This commit is contained in:
@@ -33,7 +33,6 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.format.Formatter;
|
||||
import org.springframework.format.FormatterRegistry;
|
||||
@@ -190,13 +189,6 @@ import org.springframework.web.util.pattern.PathPatternParser;
|
||||
*/
|
||||
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {
|
||||
|
||||
/**
|
||||
* Boolean flag controlled by a {@code spring.xml.ignore} system property that instructs Spring to
|
||||
* ignore XML, i.e. to not initialize the XML-related infrastructure.
|
||||
* <p>The default is "false".
|
||||
*/
|
||||
private static final boolean shouldIgnoreXml = SpringProperties.getFlag("spring.xml.ignore");
|
||||
|
||||
private static final boolean romePresent;
|
||||
|
||||
private static final boolean jaxb2Present;
|
||||
@@ -460,7 +452,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
map.put("atom", MediaType.APPLICATION_ATOM_XML);
|
||||
map.put("rss", MediaType.APPLICATION_RSS_XML);
|
||||
}
|
||||
if (!shouldIgnoreXml && (jaxb2Present || jackson2XmlPresent)) {
|
||||
if (jaxb2Present || jackson2XmlPresent) {
|
||||
map.put("xml", MediaType.APPLICATION_XML);
|
||||
}
|
||||
if (jackson2Present || gsonPresent || jsonbPresent || kotlinSerializationJsonPresent) {
|
||||
@@ -888,14 +880,13 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
messageConverters.add(new StringHttpMessageConverter());
|
||||
messageConverters.add(new ResourceHttpMessageConverter());
|
||||
messageConverters.add(new ResourceRegionHttpMessageConverter());
|
||||
if (!shouldIgnoreXml) {
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// Ignore when no TransformerFactory implementation is available...
|
||||
}
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// Ignore when no TransformerFactory implementation is available...
|
||||
}
|
||||
|
||||
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
|
||||
if (romePresent) {
|
||||
@@ -903,17 +894,15 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
messageConverters.add(new RssChannelHttpMessageConverter());
|
||||
}
|
||||
|
||||
if (!shouldIgnoreXml) {
|
||||
if (jackson2XmlPresent) {
|
||||
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.xml();
|
||||
if (this.applicationContext != null) {
|
||||
builder.applicationContext(this.applicationContext);
|
||||
}
|
||||
messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.build()));
|
||||
}
|
||||
else if (jaxb2Present) {
|
||||
messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
|
||||
if (jackson2XmlPresent) {
|
||||
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.xml();
|
||||
if (this.applicationContext != null) {
|
||||
builder.applicationContext(this.applicationContext);
|
||||
}
|
||||
messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.build()));
|
||||
}
|
||||
else if (jaxb2Present) {
|
||||
messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
|
||||
}
|
||||
|
||||
if (kotlinSerializationCborPresent) {
|
||||
|
||||
@@ -25,7 +25,6 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
@@ -57,14 +56,6 @@ import org.springframework.web.util.pattern.PathPatternParser;
|
||||
*/
|
||||
public class RouterFunctionMapping extends AbstractHandlerMapping implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Boolean flag controlled by a {@code spring.xml.ignore} system property that instructs Spring to
|
||||
* ignore XML, i.e. to not initialize the XML-related infrastructure.
|
||||
* <p>The default is "false".
|
||||
*/
|
||||
private static final boolean shouldIgnoreXml = SpringProperties.getFlag("spring.xml.ignore");
|
||||
|
||||
|
||||
@Nullable
|
||||
private RouterFunction<?> routerFunction;
|
||||
|
||||
@@ -198,14 +189,11 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
|
||||
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>(4);
|
||||
messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
messageConverters.add(new StringHttpMessageConverter());
|
||||
|
||||
if (!shouldIgnoreXml) {
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
@@ -77,14 +76,6 @@ import org.springframework.web.servlet.support.RequestContextUtils;
|
||||
public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExceptionResolver
|
||||
implements ApplicationContextAware, InitializingBean {
|
||||
|
||||
/**
|
||||
* Boolean flag controlled by a {@code spring.xml.ignore} system property that instructs Spring to
|
||||
* ignore XML, i.e. to not initialize the XML-related infrastructure.
|
||||
* <p>The default is "false".
|
||||
*/
|
||||
private static final boolean shouldIgnoreXml = SpringProperties.getFlag("spring.xml.ignore");
|
||||
|
||||
|
||||
@Nullable
|
||||
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
|
||||
|
||||
@@ -269,13 +260,11 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||
}
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(new StringHttpMessageConverter());
|
||||
if (!shouldIgnoreXml) {
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.core.MethodIntrospector;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.log.LogFormatUtils;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
@@ -117,13 +116,6 @@ import org.springframework.web.util.WebUtils;
|
||||
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
implements BeanFactoryAware, InitializingBean {
|
||||
|
||||
/**
|
||||
* Boolean flag controlled by a {@code spring.xml.ignore} system property that instructs Spring to
|
||||
* ignore XML, i.e. to not initialize the XML-related infrastructure.
|
||||
* <p>The default is "false".
|
||||
*/
|
||||
private static final boolean shouldIgnoreXml = SpringProperties.getFlag("spring.xml.ignore");
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link InitBinder @InitBinder} methods.
|
||||
*/
|
||||
@@ -576,14 +568,13 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
}
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(new StringHttpMessageConverter());
|
||||
if (!shouldIgnoreXml) {
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user