Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -958,6 +958,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
|||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder(getClass().getName());
|
StringBuilder sb = new StringBuilder(getClass().getName());
|
||||||
|
|||||||
@@ -352,7 +352,8 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the provided default values to this bean.
|
* Apply the provided default values to this bean.
|
||||||
* @param defaults the defaults to apply
|
* @param defaults the default settings to apply
|
||||||
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
public void applyDefaults(BeanDefinitionDefaults defaults) {
|
public void applyDefaults(BeanDefinitionDefaults defaults) {
|
||||||
setLazyInit(defaults.isLazyInit());
|
setLazyInit(defaults.isLazyInit());
|
||||||
@@ -515,6 +516,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
|||||||
/**
|
/**
|
||||||
* Return whether this bean should be lazily initialized, i.e. not
|
* Return whether this bean should be lazily initialized, i.e. not
|
||||||
* eagerly instantiated on startup. Only applicable to a singleton bean.
|
* eagerly instantiated on startup. Only applicable to a singleton bean.
|
||||||
|
* @return whether to apply lazy-init semantics ({@code false} by default)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isLazyInit() {
|
public boolean isLazyInit() {
|
||||||
@@ -523,8 +525,9 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the autowire mode. This determines whether any automagical detection
|
* Set the autowire mode. This determines whether any automagical detection
|
||||||
* and setting of bean references will happen. Default is AUTOWIRE_NO,
|
* and setting of bean references will happen. Default is AUTOWIRE_NO
|
||||||
* which means there's no autowire.
|
* which means there won't be convention-based autowiring by name or type
|
||||||
|
* (however, there may still be explicit annotation-driven autowiring).
|
||||||
* @param autowireMode the autowire mode to set.
|
* @param autowireMode the autowire mode to set.
|
||||||
* Must be one of the constants defined in this class.
|
* Must be one of the constants defined in this class.
|
||||||
* @see #AUTOWIRE_NO
|
* @see #AUTOWIRE_NO
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,16 +23,17 @@ import org.springframework.util.StringUtils;
|
|||||||
* A simple holder for {@code BeanDefinition} property defaults.
|
* A simple holder for {@code BeanDefinition} property defaults.
|
||||||
*
|
*
|
||||||
* @author Mark Fisher
|
* @author Mark Fisher
|
||||||
|
* @author Juergen Hoeller
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
*/
|
*/
|
||||||
public class BeanDefinitionDefaults {
|
public class BeanDefinitionDefaults {
|
||||||
|
|
||||||
private boolean lazyInit;
|
private boolean lazyInit;
|
||||||
|
|
||||||
private int dependencyCheck = AbstractBeanDefinition.DEPENDENCY_CHECK_NONE;
|
|
||||||
|
|
||||||
private int autowireMode = AbstractBeanDefinition.AUTOWIRE_NO;
|
private int autowireMode = AbstractBeanDefinition.AUTOWIRE_NO;
|
||||||
|
|
||||||
|
private int dependencyCheck = AbstractBeanDefinition.DEPENDENCY_CHECK_NONE;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String initMethodName;
|
private String initMethodName;
|
||||||
|
|
||||||
@@ -40,43 +41,84 @@ public class BeanDefinitionDefaults {
|
|||||||
private String destroyMethodName;
|
private String destroyMethodName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether beans should be lazily initialized by default.
|
||||||
|
* <p>If {@code false}, the bean will get instantiated on startup by bean
|
||||||
|
* factories that perform eager initialization of singletons.
|
||||||
|
*/
|
||||||
public void setLazyInit(boolean lazyInit) {
|
public void setLazyInit(boolean lazyInit) {
|
||||||
this.lazyInit = lazyInit;
|
this.lazyInit = lazyInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether beans should be lazily initialized by default, i.e. not
|
||||||
|
* eagerly instantiated on startup. Only applicable to singleton beans.
|
||||||
|
* @return whether to apply lazy-init semantics ({@code false} by default)
|
||||||
|
*/
|
||||||
public boolean isLazyInit() {
|
public boolean isLazyInit() {
|
||||||
return this.lazyInit;
|
return this.lazyInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDependencyCheck(int dependencyCheck) {
|
/**
|
||||||
this.dependencyCheck = dependencyCheck;
|
* Set the autowire mode. This determines whether any automagical detection
|
||||||
}
|
* and setting of bean references will happen. Default is AUTOWIRE_NO
|
||||||
|
* which means there won't be convention-based autowiring by name or type
|
||||||
public int getDependencyCheck() {
|
* (however, there may still be explicit annotation-driven autowiring).
|
||||||
return this.dependencyCheck;
|
* @param autowireMode the autowire mode to set.
|
||||||
}
|
* Must be one of the constants defined in {@link AbstractBeanDefinition}.
|
||||||
|
*/
|
||||||
public void setAutowireMode(int autowireMode) {
|
public void setAutowireMode(int autowireMode) {
|
||||||
this.autowireMode = autowireMode;
|
this.autowireMode = autowireMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the default autowire mode.
|
||||||
|
*/
|
||||||
public int getAutowireMode() {
|
public int getAutowireMode() {
|
||||||
return this.autowireMode;
|
return this.autowireMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the dependency check code.
|
||||||
|
* @param dependencyCheck the code to set.
|
||||||
|
* Must be one of the constants defined in {@link AbstractBeanDefinition}.
|
||||||
|
*/
|
||||||
|
public void setDependencyCheck(int dependencyCheck) {
|
||||||
|
this.dependencyCheck = dependencyCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the default dependency check code.
|
||||||
|
*/
|
||||||
|
public int getDependencyCheck() {
|
||||||
|
return this.dependencyCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the default initializer method.
|
||||||
|
*/
|
||||||
public void setInitMethodName(@Nullable String initMethodName) {
|
public void setInitMethodName(@Nullable String initMethodName) {
|
||||||
this.initMethodName = (StringUtils.hasText(initMethodName) ? initMethodName : null);
|
this.initMethodName = (StringUtils.hasText(initMethodName) ? initMethodName : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the default initializer method.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getInitMethodName() {
|
public String getInitMethodName() {
|
||||||
return this.initMethodName;
|
return this.initMethodName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the default destroy method.
|
||||||
|
*/
|
||||||
public void setDestroyMethodName(@Nullable String destroyMethodName) {
|
public void setDestroyMethodName(@Nullable String destroyMethodName) {
|
||||||
this.destroyMethodName = (StringUtils.hasText(destroyMethodName) ? destroyMethodName : null);
|
this.destroyMethodName = (StringUtils.hasText(destroyMethodName) ? destroyMethodName : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the default destroy method.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getDestroyMethodName() {
|
public String getDestroyMethodName() {
|
||||||
return this.destroyMethodName;
|
return this.destroyMethodName;
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ public class BeanDefinitionParserDelegate {
|
|||||||
*/
|
*/
|
||||||
public BeanDefinitionDefaults getBeanDefinitionDefaults() {
|
public BeanDefinitionDefaults getBeanDefinitionDefaults() {
|
||||||
BeanDefinitionDefaults bdd = new BeanDefinitionDefaults();
|
BeanDefinitionDefaults bdd = new BeanDefinitionDefaults();
|
||||||
bdd.setLazyInit("TRUE".equalsIgnoreCase(this.defaults.getLazyInit()));
|
bdd.setLazyInit(TRUE_VALUE.equalsIgnoreCase(this.defaults.getLazyInit()));
|
||||||
bdd.setAutowireMode(getAutowireMode(DEFAULT_VALUE));
|
bdd.setAutowireMode(getAutowireMode(DEFAULT_VALUE));
|
||||||
bdd.setInitMethodName(this.defaults.getInitMethod());
|
bdd.setInitMethodName(this.defaults.getInitMethod());
|
||||||
bdd.setDestroyMethodName(this.defaults.getDestroyMethod());
|
bdd.setDestroyMethodName(this.defaults.getDestroyMethod());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -82,8 +82,9 @@ public abstract class LogFormatUtils {
|
|||||||
*/
|
*/
|
||||||
public static void traceDebug(Log logger, Function<Boolean, String> messageFactory) {
|
public static void traceDebug(Log logger, Function<Boolean, String> messageFactory) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
String logMessage = messageFactory.apply(logger.isTraceEnabled());
|
boolean traceEnabled = logger.isTraceEnabled();
|
||||||
if (logger.isTraceEnabled()) {
|
String logMessage = messageFactory.apply(traceEnabled);
|
||||||
|
if (traceEnabled) {
|
||||||
logger.trace(logMessage);
|
logger.trace(logMessage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -33,12 +33,12 @@ import static org.junit.Assert.*;
|
|||||||
public class BeanPropertySqlParameterSourceTests {
|
public class BeanPropertySqlParameterSourceTests {
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void withNullBeanPassedToCtor() throws Exception {
|
public void withNullBeanPassedToCtor() {
|
||||||
new BeanPropertySqlParameterSource(null);
|
new BeanPropertySqlParameterSource(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void getValueWhereTheUnderlyingBeanHasNoSuchProperty() throws Exception {
|
public void getValueWhereTheUnderlyingBeanHasNoSuchProperty() {
|
||||||
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
|
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
|
||||||
source.getValue("thisPropertyDoesNotExist");
|
source.getValue("thisPropertyDoesNotExist");
|
||||||
}
|
}
|
||||||
@@ -65,19 +65,19 @@ public class BeanPropertySqlParameterSourceTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hasValueWhereTheUnderlyingBeanHasNoSuchProperty() throws Exception {
|
public void hasValueWhereTheUnderlyingBeanHasNoSuchProperty() {
|
||||||
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
|
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
|
||||||
assertFalse(source.hasValue("thisPropertyDoesNotExist"));
|
assertFalse(source.hasValue("thisPropertyDoesNotExist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void getValueWhereTheUnderlyingBeanPropertyIsNotReadable() throws Exception {
|
public void getValueWhereTheUnderlyingBeanPropertyIsNotReadable() {
|
||||||
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
|
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
|
||||||
source.getValue("noOp");
|
source.getValue("noOp");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hasValueWhereTheUnderlyingBeanPropertyIsNotReadable() throws Exception {
|
public void hasValueWhereTheUnderlyingBeanPropertyIsNotReadable() {
|
||||||
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
|
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
|
||||||
assertFalse(source.hasValue("noOp"));
|
assertFalse(source.hasValue("noOp"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2006 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -29,18 +29,18 @@ import static org.junit.Assert.*;
|
|||||||
public class MapSqlParameterSourceTests {
|
public class MapSqlParameterSourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nullParameterValuesPassedToCtorIsOk() throws Exception {
|
public void nullParameterValuesPassedToCtorIsOk() {
|
||||||
new MapSqlParameterSource(null);
|
new MapSqlParameterSource(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void getValueChokesIfParameterIsNotPresent() throws Exception {
|
public void getValueChokesIfParameterIsNotPresent() {
|
||||||
MapSqlParameterSource source = new MapSqlParameterSource();
|
MapSqlParameterSource source = new MapSqlParameterSource();
|
||||||
source.getValue("pechorin was right!");
|
source.getValue("pechorin was right!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sqlParameterValueRegistersSqlType() throws Exception {
|
public void sqlParameterValueRegistersSqlType() {
|
||||||
MapSqlParameterSource msps = new MapSqlParameterSource("FOO", new SqlParameterValue(2, "Foo"));
|
MapSqlParameterSource msps = new MapSqlParameterSource("FOO", new SqlParameterValue(2, "Foo"));
|
||||||
assertEquals("Correct SQL Type not registered", 2, msps.getSqlType("FOO"));
|
assertEquals("Correct SQL Type not registered", 2, msps.getSqlType("FOO"));
|
||||||
MapSqlParameterSource msps2 = new MapSqlParameterSource();
|
MapSqlParameterSource msps2 = new MapSqlParameterSource();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -111,16 +111,16 @@ import org.springframework.util.xml.StaxUtils;
|
|||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @see #setContextPath(String)
|
* @see #setContextPath
|
||||||
* @see #setClassesToBeBound(Class[])
|
* @see #setClassesToBeBound
|
||||||
* @see #setJaxbContextProperties(Map)
|
* @see #setJaxbContextProperties
|
||||||
* @see #setMarshallerProperties(Map)
|
* @see #setMarshallerProperties
|
||||||
* @see #setUnmarshallerProperties(Map)
|
* @see #setUnmarshallerProperties
|
||||||
* @see #setSchema(Resource)
|
* @see #setSchema
|
||||||
* @see #setSchemas(Resource[])
|
* @see #setSchemas
|
||||||
* @see #setMarshallerListener(javax.xml.bind.Marshaller.Listener)
|
* @see #setMarshallerListener
|
||||||
* @see #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener)
|
* @see #setUnmarshallerListener
|
||||||
* @see #setAdapters(XmlAdapter[])
|
* @see #setAdapters
|
||||||
*/
|
*/
|
||||||
public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, GenericMarshaller, GenericUnmarshaller,
|
public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, GenericMarshaller, GenericUnmarshaller,
|
||||||
BeanClassLoaderAware, InitializingBean {
|
BeanClassLoaderAware, InitializingBean {
|
||||||
@@ -246,8 +246,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
* Set the packages to search for classes with JAXB2 annotations in the classpath.
|
* Set the packages to search for classes with JAXB2 annotations in the classpath.
|
||||||
* This is using a Spring-bases search and therefore analogous to Spring's component-scan
|
* This is using a Spring-bases search and therefore analogous to Spring's component-scan
|
||||||
* feature ({@link org.springframework.context.annotation.ClassPathBeanDefinitionScanner}).
|
* feature ({@link org.springframework.context.annotation.ClassPathBeanDefinitionScanner}).
|
||||||
* <p>Setting either this property, {@link #setContextPath "contextPath"}
|
* <p>Setting either this property, {@link #setContextPath "contextPath"} or
|
||||||
* or {@link #setClassesToBeBound "classesToBeBound"} is required.
|
* {@link #setClassesToBeBound "classesToBeBound"} is required.
|
||||||
*/
|
*/
|
||||||
public void setPackagesToScan(@Nullable String... packagesToScan) {
|
public void setPackagesToScan(@Nullable String... packagesToScan) {
|
||||||
this.packagesToScan = packagesToScan;
|
this.packagesToScan = packagesToScan;
|
||||||
@@ -270,8 +270,9 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the JAXB {@code Marshaller} properties. These properties will be set on the
|
* Set the JAXB {@code Marshaller} properties.
|
||||||
* underlying JAXB {@code Marshaller}, and allow for features such as indentation.
|
* <p>These properties will be set on the underlying JAXB {@code Marshaller},
|
||||||
|
* and allow for features such as indentation.
|
||||||
* @param properties the properties
|
* @param properties the properties
|
||||||
* @see javax.xml.bind.Marshaller#setProperty(String, Object)
|
* @see javax.xml.bind.Marshaller#setProperty(String, Object)
|
||||||
* @see javax.xml.bind.Marshaller#JAXB_ENCODING
|
* @see javax.xml.bind.Marshaller#JAXB_ENCODING
|
||||||
@@ -284,8 +285,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the JAXB {@code Unmarshaller} properties. These properties will be set on the
|
* Set the JAXB {@code Unmarshaller} properties.
|
||||||
* underlying JAXB {@code Unmarshaller}.
|
* <p>These properties will be set on the underlying JAXB {@code Unmarshaller}.
|
||||||
* @param properties the properties
|
* @param properties the properties
|
||||||
* @see javax.xml.bind.Unmarshaller#setProperty(String, Object)
|
* @see javax.xml.bind.Unmarshaller#setProperty(String, Object)
|
||||||
*/
|
*/
|
||||||
@@ -338,7 +339,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the schema language. Default is the W3C XML Schema: {@code http://www.w3.org/2001/XMLSchema"}.
|
* Set the schema language.
|
||||||
|
* Default is the W3C XML Schema: {@code http://www.w3.org/2001/XMLSchema"}.
|
||||||
* @see XMLConstants#W3C_XML_SCHEMA_NS_URI
|
* @see XMLConstants#W3C_XML_SCHEMA_NS_URI
|
||||||
* @see XMLConstants#RELAXNG_NS_URI
|
* @see XMLConstants#RELAXNG_NS_URI
|
||||||
*/
|
*/
|
||||||
@@ -349,8 +351,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
/**
|
/**
|
||||||
* Set the resource resolver, as used to load the schema resources.
|
* Set the resource resolver, as used to load the schema resources.
|
||||||
* @see SchemaFactory#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
|
* @see SchemaFactory#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
|
||||||
* @see #setSchema(Resource)
|
* @see #setSchema
|
||||||
* @see #setSchemas(Resource[])
|
* @see #setSchemas
|
||||||
*/
|
*/
|
||||||
public void setSchemaResourceResolver(LSResourceResolver schemaResourceResolver) {
|
public void setSchemaResourceResolver(LSResourceResolver schemaResourceResolver) {
|
||||||
this.schemaResourceResolver = schemaResourceResolver;
|
this.schemaResourceResolver = schemaResourceResolver;
|
||||||
@@ -374,10 +376,11 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify whether the {@link #supports(Class)} returns {@code true} for the {@link JAXBElement} class.
|
* Specify whether the {@link #supports(Class)} returns {@code true} for the
|
||||||
* <p>Default is {@code false}, meaning that {@code supports(Class)} always returns {@code false} for
|
* {@link JAXBElement} class.
|
||||||
* {@code JAXBElement} classes (though {@link #supports(Type)} can return {@code true}, since it can
|
* <p>Default is {@code false}, meaning that {@code supports(Class)} always returns
|
||||||
* obtain the type parameters of {@code JAXBElement}).
|
* {@code false} for {@code JAXBElement} classes (though {@link #supports(Type)} can
|
||||||
|
* return {@code true}, since it can obtain the type parameters of {@code JAXBElement}).
|
||||||
* <p>This property is typically enabled in combination with usage of classes like
|
* <p>This property is typically enabled in combination with usage of classes like
|
||||||
* {@link org.springframework.web.servlet.view.xml.MarshallingView MarshallingView},
|
* {@link org.springframework.web.servlet.view.xml.MarshallingView MarshallingView},
|
||||||
* since the {@code ModelAndView} does not offer type parameter information at runtime.
|
* since the {@code ModelAndView} does not offer type parameter information at runtime.
|
||||||
@@ -433,8 +436,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
* {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or
|
* {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or
|
||||||
* {@link StreamSource}. It has no effect for {@link DOMSource} or {@link StAXSource}
|
* {@link StreamSource}. It has no effect for {@link DOMSource} or {@link StAXSource}
|
||||||
* instances.
|
* instances.
|
||||||
* <p><strong>Note:</strong> setting this option to {@code true} also
|
* <p><strong>Note:</strong> setting this option to {@code true} also automatically
|
||||||
* automatically sets {@link #setSupportDtd} to {@code true}.
|
* sets {@link #setSupportDtd} to {@code true}.
|
||||||
*/
|
*/
|
||||||
public void setProcessExternalEntities(boolean processExternalEntities) {
|
public void setProcessExternalEntities(boolean processExternalEntities) {
|
||||||
this.processExternalEntities = processExternalEntities;
|
this.processExternalEntities = processExternalEntities;
|
||||||
@@ -710,6 +713,21 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a newly created JAXB marshaller.
|
||||||
|
* <p>Note: JAXB marshallers are not necessarily thread-safe.
|
||||||
|
*/
|
||||||
|
protected Marshaller createMarshaller() {
|
||||||
|
try {
|
||||||
|
Marshaller marshaller = getJaxbContext().createMarshaller();
|
||||||
|
initJaxbMarshaller(marshaller);
|
||||||
|
return marshaller;
|
||||||
|
}
|
||||||
|
catch (JAXBException ex) {
|
||||||
|
throw convertJaxbException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void marshalStaxResult(Marshaller jaxbMarshaller, Object graph, Result staxResult) throws JAXBException {
|
private void marshalStaxResult(Marshaller jaxbMarshaller, Object graph, Result staxResult) throws JAXBException {
|
||||||
XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(staxResult);
|
XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(staxResult);
|
||||||
if (streamWriter != null) {
|
if (streamWriter != null) {
|
||||||
@@ -727,26 +745,14 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a newly created JAXB marshaller. JAXB marshallers are not necessarily thread safe.
|
* Template method that can be overridden by concrete JAXB marshallers
|
||||||
*/
|
* for custom initialization behavior. Gets called after creation of JAXB
|
||||||
protected Marshaller createMarshaller() {
|
* {@code Marshaller}, and after the respective properties have been set.
|
||||||
try {
|
* <p>The default implementation sets the
|
||||||
Marshaller marshaller = getJaxbContext().createMarshaller();
|
* {@link #setMarshallerProperties defined properties}, the
|
||||||
initJaxbMarshaller(marshaller);
|
* {@link #setValidationEventHandler validation event handler}, the
|
||||||
return marshaller;
|
* {@link #setSchemas schemas}, {@link #setMarshallerListener listener},
|
||||||
}
|
* and {@link #setAdapters adapters}.
|
||||||
catch (JAXBException ex) {
|
|
||||||
throw convertJaxbException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior.
|
|
||||||
* Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set.
|
|
||||||
* <p>The default implementation sets the {@link #setMarshallerProperties(Map) defined properties}, the {@link
|
|
||||||
* #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[])
|
|
||||||
* schemas}, {@link #setMarshallerListener(javax.xml.bind.Marshaller.Listener) listener}, and
|
|
||||||
* {@link #setAdapters(XmlAdapter[]) adapters}.
|
|
||||||
*/
|
*/
|
||||||
protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException {
|
protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException {
|
||||||
if (this.marshallerProperties != null) {
|
if (this.marshallerProperties != null) {
|
||||||
@@ -809,6 +815,21 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a newly created JAXB unmarshaller.
|
||||||
|
* <p>Note: JAXB unmarshallers are not necessarily thread-safe.
|
||||||
|
*/
|
||||||
|
protected Unmarshaller createUnmarshaller() {
|
||||||
|
try {
|
||||||
|
Unmarshaller unmarshaller = getJaxbContext().createUnmarshaller();
|
||||||
|
initJaxbUnmarshaller(unmarshaller);
|
||||||
|
return unmarshaller;
|
||||||
|
}
|
||||||
|
catch (JAXBException ex) {
|
||||||
|
throw convertJaxbException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException {
|
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException {
|
||||||
XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource);
|
XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource);
|
||||||
if (streamReader != null) {
|
if (streamReader != null) {
|
||||||
@@ -875,27 +896,14 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a newly created JAXB unmarshaller.
|
* Template method that can be overridden by concrete JAXB marshallers
|
||||||
* Note: JAXB unmarshallers are not necessarily thread-safe.
|
* for custom initialization behavior. Gets called after creation of JAXB
|
||||||
*/
|
* {@code Marshaller}, and after the respective properties have been set.
|
||||||
protected Unmarshaller createUnmarshaller() {
|
* <p>The default implementation sets the
|
||||||
try {
|
* {@link #setUnmarshallerProperties defined properties}, the
|
||||||
Unmarshaller unmarshaller = getJaxbContext().createUnmarshaller();
|
* {@link #setValidationEventHandler validation event handler}, the
|
||||||
initJaxbUnmarshaller(unmarshaller);
|
* {@link #setSchemas schemas}, {@link #setUnmarshallerListener listener},
|
||||||
return unmarshaller;
|
* and {@link #setAdapters adapters}.
|
||||||
}
|
|
||||||
catch (JAXBException ex) {
|
|
||||||
throw convertJaxbException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior.
|
|
||||||
* Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set.
|
|
||||||
* <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link
|
|
||||||
* #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[])
|
|
||||||
* schemas}, {@link #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) listener}, and
|
|
||||||
* {@link #setAdapters(XmlAdapter[]) adapters}.
|
|
||||||
*/
|
*/
|
||||||
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
|
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
|
||||||
if (this.unmarshallerProperties != null) {
|
if (this.unmarshallerProperties != null) {
|
||||||
@@ -920,8 +928,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the given {@code JAXBException} to an appropriate exception from the
|
* Convert the given {@code JAXBException} to an appropriate exception
|
||||||
* {@code org.springframework.oxm} hierarchy.
|
* from the {@code org.springframework.oxm} hierarchy.
|
||||||
* @param ex {@code JAXBException} that occurred
|
* @param ex {@code JAXBException} that occurred
|
||||||
* @return the corresponding {@code XmlMappingException}
|
* @return the corresponding {@code XmlMappingException}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -52,14 +52,14 @@ public class CorsConfiguration {
|
|||||||
/** Wildcard representing <em>all</em> origins, methods, or headers. */
|
/** Wildcard representing <em>all</em> origins, methods, or headers. */
|
||||||
public static final String ALL = "*";
|
public static final String ALL = "*";
|
||||||
|
|
||||||
private static final List<HttpMethod> DEFAULT_METHODS =
|
private static final List<HttpMethod> DEFAULT_METHODS = Collections.unmodifiableList(
|
||||||
Collections.unmodifiableList(Arrays.asList(HttpMethod.GET, HttpMethod.HEAD));
|
Arrays.asList(HttpMethod.GET, HttpMethod.HEAD));
|
||||||
|
|
||||||
private static final List<String> DEFAULT_PERMIT_ALL =
|
private static final List<String> DEFAULT_PERMIT_METHODS = Collections.unmodifiableList(
|
||||||
Collections.unmodifiableList(Arrays.asList(ALL));
|
Arrays.asList(HttpMethod.GET.name(), HttpMethod.HEAD.name(), HttpMethod.POST.name()));
|
||||||
|
|
||||||
private static final List<String> DEFAULT_PERMIT_METHODS =
|
private static final List<String> DEFAULT_PERMIT_ALL = Collections.unmodifiableList(
|
||||||
Collections.unmodifiableList(Arrays.asList(HttpMethod.GET.name(), HttpMethod.HEAD.name(), HttpMethod.POST.name()));
|
Collections.singletonList(ALL));
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -322,22 +322,21 @@ public class CorsConfiguration {
|
|||||||
return this.maxAge;
|
return this.maxAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default a newly created {@code CorsConfiguration} does not permit any
|
* By default a newly created {@code CorsConfiguration} does not permit any
|
||||||
* cross-origin requests and must be configured explicitly to indicate what
|
* cross-origin requests and must be configured explicitly to indicate what
|
||||||
* should be allowed.
|
* should be allowed.
|
||||||
*
|
|
||||||
* <p>Use this method to flip the initialization model to start with open
|
* <p>Use this method to flip the initialization model to start with open
|
||||||
* defaults that permit all cross-origin requests for GET, HEAD, and POST
|
* defaults that permit all cross-origin requests for GET, HEAD, and POST
|
||||||
* requests. Note however that this method will not override any existing
|
* requests. Note however that this method will not override any existing
|
||||||
* values already set.
|
* values already set.
|
||||||
*
|
|
||||||
* <p>The following defaults are applied if not already set:
|
* <p>The following defaults are applied if not already set:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Allow all origins.</li>
|
* <li>Allow all origins.</li>
|
||||||
* <li>Allow "simple" methods {@code GET}, {@code HEAD} and {@code POST}.</li>
|
* <li>Allow "simple" methods {@code GET}, {@code HEAD} and {@code POST}.</li>
|
||||||
* <li>Allow all headers.</li>
|
* <li>Allow all headers.</li>
|
||||||
* <li>Set max age to 1800 seconds (30 minutes).</li>
|
* <li>Set max age to 1800 seconds (30 minutes).</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public CorsConfiguration applyPermitDefaultValues() {
|
public CorsConfiguration applyPermitDefaultValues() {
|
||||||
@@ -361,23 +360,19 @@ public class CorsConfiguration {
|
|||||||
/**
|
/**
|
||||||
* Combine the non-null properties of the supplied
|
* Combine the non-null properties of the supplied
|
||||||
* {@code CorsConfiguration} with this one.
|
* {@code CorsConfiguration} with this one.
|
||||||
*
|
|
||||||
* <p>When combining single values like {@code allowCredentials} or
|
* <p>When combining single values like {@code allowCredentials} or
|
||||||
* {@code maxAge}, {@code this} properties are overridden by non-null
|
* {@code maxAge}, {@code this} properties are overridden by non-null
|
||||||
* {@code other} properties if any.
|
* {@code other} properties if any.
|
||||||
*
|
|
||||||
* <p>Combining lists like {@code allowedOrigins}, {@code allowedMethods},
|
* <p>Combining lists like {@code allowedOrigins}, {@code allowedMethods},
|
||||||
* {@code allowedHeaders} or {@code exposedHeaders} is done in an additive
|
* {@code allowedHeaders} or {@code exposedHeaders} is done in an additive
|
||||||
* way. For example, combining {@code ["GET", "POST"]} with
|
* way. For example, combining {@code ["GET", "POST"]} with
|
||||||
* {@code ["PATCH"]} results in {@code ["GET", "POST", "PATCH"]}, but keep
|
* {@code ["PATCH"]} results in {@code ["GET", "POST", "PATCH"]}, but keep
|
||||||
* in mind that combining {@code ["GET", "POST"]} with {@code ["*"]}
|
* in mind that combining {@code ["GET", "POST"]} with {@code ["*"]}
|
||||||
* results in {@code ["*"]}.
|
* results in {@code ["*"]}.
|
||||||
*
|
|
||||||
* <p>Notice that default permit values set by
|
* <p>Notice that default permit values set by
|
||||||
* {@link CorsConfiguration#applyPermitDefaultValues()} are overridden by
|
* {@link CorsConfiguration#applyPermitDefaultValues()} are overridden by
|
||||||
* any value explicitly defined.
|
* any value explicitly defined.
|
||||||
*
|
* @return the combined {@code CorsConfiguration}, or {@code this}
|
||||||
* @return the combined {@code CorsConfiguration} or {@code this}
|
|
||||||
* configuration if the supplied configuration is {@code null}
|
* configuration if the supplied configuration is {@code null}
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -116,7 +116,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
|
public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
|
||||||
this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath);
|
this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath);
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setAlwaysUseFullPath(alwaysUseFullPath);
|
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setAlwaysUseFullPath(alwaysUseFullPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
public void setUrlDecode(boolean urlDecode) {
|
public void setUrlDecode(boolean urlDecode) {
|
||||||
this.urlPathHelper.setUrlDecode(urlDecode);
|
this.urlPathHelper.setUrlDecode(urlDecode);
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setUrlDecode(urlDecode);
|
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setUrlDecode(urlDecode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
|
public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
|
||||||
this.urlPathHelper.setRemoveSemicolonContent(removeSemicolonContent);
|
this.urlPathHelper.setRemoveSemicolonContent(removeSemicolonContent);
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setRemoveSemicolonContent(removeSemicolonContent);
|
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setRemoveSemicolonContent(removeSemicolonContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
Assert.notNull(urlPathHelper, "UrlPathHelper must not be null");
|
Assert.notNull(urlPathHelper, "UrlPathHelper must not be null");
|
||||||
this.urlPathHelper = urlPathHelper;
|
this.urlPathHelper = urlPathHelper;
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setUrlPathHelper(urlPathHelper);
|
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setUrlPathHelper(urlPathHelper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
||||||
this.pathMatcher = pathMatcher;
|
this.pathMatcher = pathMatcher;
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setPathMatcher(pathMatcher);
|
((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).setPathMatcher(pathMatcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public Map<String, CorsConfiguration> getCorsConfigurations() {
|
public Map<String, CorsConfiguration> getCorsConfigurations() {
|
||||||
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) {
|
||||||
return ((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).getCorsConfigurations();
|
return ((UrlBasedCorsConfigurationSource) this.corsConfigurationSource).getCorsConfigurations();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("No CORS configurations available when the source " +
|
throw new IllegalStateException("No CORS configurations available when the source " +
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class MvcNamespaceTests {
|
|||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setup() throws Exception {
|
||||||
TestMockServletContext servletContext = new TestMockServletContext();
|
TestMockServletContext servletContext = new TestMockServletContext();
|
||||||
appContext = new XmlWebApplicationContext();
|
appContext = new XmlWebApplicationContext();
|
||||||
appContext.setServletContext(servletContext);
|
appContext.setServletContext(servletContext);
|
||||||
@@ -889,7 +889,7 @@ public class MvcNamespaceTests {
|
|||||||
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
|
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
|
||||||
assertNotNull(handlerMapping);
|
assertNotNull(handlerMapping);
|
||||||
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
|
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
|
||||||
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource)accessor
|
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource) accessor
|
||||||
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
|
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
|
||||||
assertNotNull(configs);
|
assertNotNull(configs);
|
||||||
assertEquals(1, configs.size());
|
assertEquals(1, configs.size());
|
||||||
@@ -914,7 +914,7 @@ public class MvcNamespaceTests {
|
|||||||
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
|
AbstractHandlerMapping handlerMapping = (AbstractHandlerMapping)appContext.getBean(beanName);
|
||||||
assertNotNull(handlerMapping);
|
assertNotNull(handlerMapping);
|
||||||
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
|
DirectFieldAccessor accessor = new DirectFieldAccessor(handlerMapping);
|
||||||
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource)accessor
|
Map<String, CorsConfiguration> configs = ((UrlBasedCorsConfigurationSource) accessor
|
||||||
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
|
.getPropertyValue("corsConfigurationSource")).getCorsConfigurations();
|
||||||
assertNotNull(configs);
|
assertNotNull(configs);
|
||||||
assertEquals(2, configs.size());
|
assertEquals(2, configs.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user