Javadoc format and related polishing
This commit is contained in:
parent
3dd6c19c6d
commit
9d0e62ef68
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -34,6 +34,7 @@ import org.springframework.lang.Nullable;
|
||||||
* for detailed instructions.
|
* for detailed instructions.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
|
* @author Stephane Nicoll
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
* @see EnableCaching
|
* @see EnableCaching
|
||||||
* @see CachingConfigurerSupport
|
* @see CachingConfigurerSupport
|
||||||
|
@ -69,8 +70,8 @@ public interface CachingConfigurer {
|
||||||
* Return the {@link CacheResolver} bean to use to resolve regular caches for
|
* Return the {@link CacheResolver} bean to use to resolve regular caches for
|
||||||
* annotation-driven cache management. This is an alternative and more powerful
|
* annotation-driven cache management. This is an alternative and more powerful
|
||||||
* option of specifying the {@link CacheManager} to use.
|
* option of specifying the {@link CacheManager} to use.
|
||||||
* <p>If both a {@link #cacheManager()} and {@link #cacheResolver()} are set, the
|
* <p>If both a {@link #cacheManager()} and {@code #cacheResolver()} are set,
|
||||||
* cache manager is ignored.
|
* the cache manager is ignored.
|
||||||
* <p>Implementations must explicitly declare
|
* <p>Implementations must explicitly declare
|
||||||
* {@link org.springframework.context.annotation.Bean @Bean}, e.g.
|
* {@link org.springframework.context.annotation.Bean @Bean}, e.g.
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -185,7 +185,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS
|
||||||
/**
|
/**
|
||||||
* Implemented for compatibility with {@link org.springframework.beans.factory.config.PlaceholderConfigurerSupport}.
|
* Implemented for compatibility with {@link org.springframework.beans.factory.config.PlaceholderConfigurerSupport}.
|
||||||
* @deprecated in favor of {@link #processProperties(ConfigurableListableBeanFactory, ConfigurablePropertyResolver)}
|
* @deprecated in favor of {@link #processProperties(ConfigurableListableBeanFactory, ConfigurablePropertyResolver)}
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -58,7 +58,7 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter,
|
||||||
* @param ps the PreparedStatement
|
* @param ps the PreparedStatement
|
||||||
* @param parameterPosition index of the parameter position
|
* @param parameterPosition index of the parameter position
|
||||||
* @param argValue the value to set
|
* @param argValue the value to set
|
||||||
* @throws SQLException
|
* @throws SQLException if thrown by PreparedStatement methods
|
||||||
*/
|
*/
|
||||||
protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException {
|
protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException {
|
||||||
if (argValue instanceof SqlParameterValue) {
|
if (argValue instanceof SqlParameterValue) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -92,7 +92,7 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet
|
||||||
* @param parameterPosition index of the parameter position
|
* @param parameterPosition index of the parameter position
|
||||||
* @param argType the argument type
|
* @param argType the argument type
|
||||||
* @param argValue the argument value
|
* @param argValue the argument value
|
||||||
* @throws SQLException
|
* @throws SQLException if thrown by PreparedStatement methods
|
||||||
*/
|
*/
|
||||||
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue)
|
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public abstract class SqlParameterSourceUtils {
|
||||||
* @return an array of {@link SqlParameterSource}
|
* @return an array of {@link SqlParameterSource}
|
||||||
* @see MapSqlParameterSource
|
* @see MapSqlParameterSource
|
||||||
* @see BeanPropertySqlParameterSource
|
* @see BeanPropertySqlParameterSource
|
||||||
* @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[]))
|
* @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static SqlParameterSource[] createBatch(Object... candidates) {
|
public static SqlParameterSource[] createBatch(Object... candidates) {
|
||||||
|
@ -58,7 +58,7 @@ public abstract class SqlParameterSourceUtils {
|
||||||
* @since 5.0.2
|
* @since 5.0.2
|
||||||
* @see MapSqlParameterSource
|
* @see MapSqlParameterSource
|
||||||
* @see BeanPropertySqlParameterSource
|
* @see BeanPropertySqlParameterSource
|
||||||
* @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[]))
|
* @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static SqlParameterSource[] createBatch(Collection<?> candidates) {
|
public static SqlParameterSource[] createBatch(Collection<?> candidates) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -133,7 +133,7 @@ public abstract class SessionFactoryUtils {
|
||||||
* {@link PersistenceException} wrappers accordingly.
|
* {@link PersistenceException} wrappers accordingly.
|
||||||
* @param session the Hibernate Session to flush
|
* @param session the Hibernate Session to flush
|
||||||
* @param synch whether this flush is triggered by transaction synchronization
|
* @param synch whether this flush is triggered by transaction synchronization
|
||||||
* @throws DataAccessException
|
* @throws DataAccessException in case of flush failures
|
||||||
* @since 4.3.2
|
* @since 4.3.2
|
||||||
*/
|
*/
|
||||||
static void flush(Session session, boolean synch) throws DataAccessException {
|
static void flush(Session session, boolean synch) throws DataAccessException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -109,7 +109,7 @@ public @interface IfProfileValue {
|
||||||
/**
|
/**
|
||||||
* A single, permissible {@code value} of the <em>profile value</em>
|
* A single, permissible {@code value} of the <em>profile value</em>
|
||||||
* for the given {@link #name}.
|
* for the given {@link #name}.
|
||||||
* <p>Note: Assigning values to both {@link #value} and {@link #values}
|
* <p>Note: Assigning values to both {@code #value} and {@link #values}
|
||||||
* will lead to a configuration conflict.
|
* will lead to a configuration conflict.
|
||||||
*/
|
*/
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
@ -117,7 +117,7 @@ public @interface IfProfileValue {
|
||||||
/**
|
/**
|
||||||
* A list of all permissible {@code values} of the <em>profile value</em>
|
* A list of all permissible {@code values} of the <em>profile value</em>
|
||||||
* for the given {@link #name}.
|
* for the given {@link #name}.
|
||||||
* <p>Note: Assigning values to both {@link #value} and {@link #values}
|
* <p>Note: Assigning values to both {@link #value} and {@code #values}
|
||||||
* will lead to a configuration conflict.
|
* will lead to a configuration conflict.
|
||||||
*/
|
*/
|
||||||
String[] values() default {};
|
String[] values() default {};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -54,7 +54,7 @@ public interface ContextCache {
|
||||||
String CONTEXT_CACHE_LOGGING_CATEGORY = "org.springframework.test.context.cache";
|
String CONTEXT_CACHE_LOGGING_CATEGORY = "org.springframework.test.context.cache";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default maximum size of the context cache: {@value #DEFAULT_MAX_CONTEXT_CACHE_SIZE}.
|
* The default maximum size of the context cache: {@value}.
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
* @see #MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME
|
* @see #MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -72,7 +72,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||||
private static final Log logger = LogFactory.getLog(AbstractContextLoader.class);
|
private static final Log logger = LogFactory.getLog(AbstractContextLoader.class);
|
||||||
|
|
||||||
|
|
||||||
// --- SmartContextLoader -----------------------------------------------
|
// SmartContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For backwards compatibility with the {@link ContextLoader} SPI, the
|
* For backwards compatibility with the {@link ContextLoader} SPI, the
|
||||||
|
@ -189,7 +189,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- ContextLoader -------------------------------------------------------
|
// ContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the supplied {@code locations} are {@code null} or <em>empty</em>
|
* If the supplied {@code locations} are {@code null} or <em>empty</em>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -67,6 +67,7 @@ import org.springframework.util.Assert;
|
||||||
* not result in an exception.
|
* not result in an exception.
|
||||||
*
|
*
|
||||||
* @author Sam Brannen
|
* @author Sam Brannen
|
||||||
|
* @author Phillip Webb
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
* @see SmartContextLoader
|
* @see SmartContextLoader
|
||||||
*/
|
*/
|
||||||
|
@ -86,16 +87,13 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
*/
|
*/
|
||||||
protected abstract SmartContextLoader getAnnotationConfigLoader();
|
protected abstract SmartContextLoader getAnnotationConfigLoader();
|
||||||
|
|
||||||
// --- SmartContextLoader --------------------------------------------------
|
|
||||||
|
|
||||||
private static String name(SmartContextLoader loader) {
|
// SmartContextLoader
|
||||||
return loader.getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void delegateProcessing(SmartContextLoader loader, ContextConfigurationAttributes configAttributes) {
|
private static void delegateProcessing(SmartContextLoader loader, ContextConfigurationAttributes configAttributes) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(String.format("Delegating to %s to process context configuration %s.", name(loader),
|
logger.debug(String.format("Delegating to %s to process context configuration %s.",
|
||||||
configAttributes));
|
name(loader), configAttributes));
|
||||||
}
|
}
|
||||||
loader.processContextConfiguration(configAttributes);
|
loader.processContextConfiguration(configAttributes);
|
||||||
}
|
}
|
||||||
|
@ -111,10 +109,10 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
|
|
||||||
private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) {
|
private boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) {
|
||||||
if (loader == getAnnotationConfigLoader()) {
|
if (loader == getAnnotationConfigLoader()) {
|
||||||
return mergedConfig.hasClasses() && !mergedConfig.hasLocations();
|
return (mergedConfig.hasClasses() && !mergedConfig.hasLocations());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return mergedConfig.hasLocations() && !mergedConfig.hasClasses();
|
return (mergedConfig.hasLocations() && !mergedConfig.hasClasses());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +150,9 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
@Override
|
@Override
|
||||||
public void processContextConfiguration(final ContextConfigurationAttributes configAttributes) {
|
public void processContextConfiguration(final ContextConfigurationAttributes configAttributes) {
|
||||||
Assert.notNull(configAttributes, "configAttributes must not be null");
|
Assert.notNull(configAttributes, "configAttributes must not be null");
|
||||||
Assert.isTrue(!(configAttributes.hasLocations() && configAttributes.hasClasses()), () -> String.format(
|
Assert.isTrue(!(configAttributes.hasLocations() && configAttributes.hasClasses()),
|
||||||
"Cannot process locations AND classes for context configuration %s: "
|
() -> String.format("Cannot process locations AND classes for context configuration %s: " +
|
||||||
+ "configure one or the other, but not both.", configAttributes));
|
"configure one or the other, but not both.", configAttributes));
|
||||||
|
|
||||||
// If the original locations or classes were not empty, there's no
|
// If the original locations or classes were not empty, there's no
|
||||||
// need to bother with default detection checks; just let the
|
// need to bother with default detection checks; just let the
|
||||||
|
@ -188,8 +186,7 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
|
|
||||||
if (configAttributes.hasClasses()) {
|
if (configAttributes.hasClasses()) {
|
||||||
if (logger.isInfoEnabled()) {
|
if (logger.isInfoEnabled()) {
|
||||||
logger.info(String.format(
|
logger.info(String.format("%s detected default configuration classes for context configuration %s.",
|
||||||
"%s detected default configuration classes for context configuration %s.",
|
|
||||||
name(getAnnotationConfigLoader()), configAttributes));
|
name(getAnnotationConfigLoader()), configAttributes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,12 +196,12 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
name(getAnnotationConfigLoader()), configAttributes));
|
name(getAnnotationConfigLoader()), configAttributes));
|
||||||
|
|
||||||
if (configAttributes.hasLocations() && configAttributes.hasClasses()) {
|
if (configAttributes.hasLocations() && configAttributes.hasClasses()) {
|
||||||
String message = String.format(
|
String msg = String.format(
|
||||||
"Configuration error: both default locations AND default configuration classes "
|
"Configuration error: both default locations AND default configuration classes " +
|
||||||
+ "were detected for context configuration %s; configure one or the other, but not both.",
|
"were detected for context configuration %s; configure one or the other, but not both.",
|
||||||
configAttributes);
|
configAttributes);
|
||||||
logger.error(message);
|
logger.error(msg);
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,8 +232,8 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
List<SmartContextLoader> candidates = Arrays.asList(getXmlLoader(), getAnnotationConfigLoader());
|
List<SmartContextLoader> candidates = Arrays.asList(getXmlLoader(), getAnnotationConfigLoader());
|
||||||
|
|
||||||
Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format(
|
Assert.state(!(mergedConfig.hasLocations() && mergedConfig.hasClasses()), () -> String.format(
|
||||||
"Neither %s nor %s supports loading an ApplicationContext from %s: "
|
"Neither %s nor %s supports loading an ApplicationContext from %s: " +
|
||||||
+ "declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
|
"declare either 'locations' or 'classes' but not both.", name(getXmlLoader()),
|
||||||
name(getAnnotationConfigLoader()), mergedConfig));
|
name(getAnnotationConfigLoader()), mergedConfig));
|
||||||
|
|
||||||
for (SmartContextLoader loader : candidates) {
|
for (SmartContextLoader loader : candidates) {
|
||||||
|
@ -260,30 +257,37 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||||
name(getAnnotationConfigLoader()), mergedConfig));
|
name(getAnnotationConfigLoader()), mergedConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ContextLoader -------------------------------------------------------
|
private static String name(SmartContextLoader loader) {
|
||||||
|
return loader.getClass().getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code AbstractDelegatingSmartContextLoader} does not support the
|
* {@code AbstractDelegatingSmartContextLoader} does not support the
|
||||||
* {@link ContextLoader#processLocations(Class, String...)} method. Call
|
* {@link ContextLoader#processLocations(Class, String...)} method. Call
|
||||||
* {@link #processContextConfiguration(ContextConfigurationAttributes)} instead.
|
* {@link #processContextConfiguration(ContextConfigurationAttributes)} instead.
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final String[] processLocations(Class<?> clazz, @Nullable String... locations) {
|
public final String[] processLocations(Class<?> clazz, @Nullable String... locations) {
|
||||||
throw new UnsupportedOperationException("DelegatingSmartContextLoaders do not support the ContextLoader SPI. "
|
throw new UnsupportedOperationException(
|
||||||
+ "Call processContextConfiguration(ContextConfigurationAttributes) instead.");
|
"DelegatingSmartContextLoaders do not support the ContextLoader SPI. " +
|
||||||
|
"Call processContextConfiguration(ContextConfigurationAttributes) instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code AbstractDelegatingSmartContextLoader} does not support the
|
* {@code AbstractDelegatingSmartContextLoader} does not support the
|
||||||
* {@link ContextLoader#loadContext(String...) } method. Call
|
* {@link ContextLoader#loadContext(String...) } method. Call
|
||||||
* {@link #loadContext(MergedContextConfiguration)} instead.
|
* {@link #loadContext(MergedContextConfiguration)} instead.
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final ApplicationContext loadContext(String... locations) throws Exception {
|
public final ApplicationContext loadContext(String... locations) throws Exception {
|
||||||
throw new UnsupportedOperationException("DelegatingSmartContextLoaders do not support the ContextLoader SPI. "
|
throw new UnsupportedOperationException(
|
||||||
+ "Call loadContext(MergedContextConfiguration) instead.");
|
"DelegatingSmartContextLoaders do not support the ContextLoader SPI. " +
|
||||||
|
"Call loadContext(MergedContextConfiguration) instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -58,11 +58,10 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
private static final Log logger = LogFactory.getLog(AnnotationConfigContextLoader.class);
|
private static final Log logger = LogFactory.getLog(AnnotationConfigContextLoader.class);
|
||||||
|
|
||||||
|
|
||||||
// --- SmartContextLoader -----------------------------------------------
|
// SmartContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
||||||
*
|
|
||||||
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
||||||
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
||||||
* {@code SmartContextLoader} will attempt to {@link
|
* {@code SmartContextLoader} will attempt to {@link
|
||||||
|
@ -71,7 +70,6 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
||||||
* supplied configuration attributes. Otherwise, properties in the supplied
|
* supplied configuration attributes. Otherwise, properties in the supplied
|
||||||
* configuration attributes will not be modified.
|
* configuration attributes will not be modified.
|
||||||
*
|
|
||||||
* @param configAttributes the context configuration attributes to process
|
* @param configAttributes the context configuration attributes to process
|
||||||
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
|
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
|
||||||
* @see #isGenerateDefaultLocations()
|
* @see #isGenerateDefaultLocations()
|
||||||
|
@ -84,14 +82,13 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AnnotationConfigContextLoader ---------------------------------------
|
|
||||||
|
// AnnotationConfigContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect the default configuration classes for the supplied test class.
|
* Detect the default configuration classes for the supplied test class.
|
||||||
*
|
|
||||||
* <p>The default implementation simply delegates to
|
* <p>The default implementation simply delegates to
|
||||||
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses(Class)}.
|
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses(Class)}.
|
||||||
*
|
|
||||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||||
* @return an array of default configuration classes, potentially empty but
|
* @return an array of default configuration classes, potentially empty but
|
||||||
* never {@code null}
|
* never {@code null}
|
||||||
|
@ -101,16 +98,16 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
return AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(declaringClass);
|
return AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(declaringClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AbstractContextLoader -----------------------------------------------
|
|
||||||
|
// AbstractContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code AnnotationConfigContextLoader} should be used as a
|
* {@code AnnotationConfigContextLoader} should be used as a
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see AbstractContextLoader#modifyLocations
|
* @see AbstractContextLoader#modifyLocations
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String[] modifyLocations(Class<?> clazz, String... locations) {
|
protected String[] modifyLocations(Class<?> clazz, String... locations) {
|
||||||
|
@ -123,9 +120,8 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see AbstractContextLoader#generateDefaultLocations
|
* @see AbstractContextLoader#generateDefaultLocations
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String[] generateDefaultLocations(Class<?> clazz) {
|
protected String[] generateDefaultLocations(Class<?> clazz) {
|
||||||
|
@ -138,9 +134,8 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see AbstractContextLoader#getResourceSuffix
|
* @see AbstractContextLoader#getResourceSuffix
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getResourceSuffix() {
|
protected String getResourceSuffix() {
|
||||||
|
@ -148,7 +143,8 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
"AnnotationConfigContextLoader does not support the getResourceSuffix() method");
|
"AnnotationConfigContextLoader does not support the getResourceSuffix() method");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AbstractGenericContextLoader ----------------------------------------
|
|
||||||
|
// AbstractGenericContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that the supplied {@link MergedContextConfiguration} does not
|
* Ensure that the supplied {@link MergedContextConfiguration} does not
|
||||||
|
@ -159,10 +155,10 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
@Override
|
@Override
|
||||||
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
|
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
|
||||||
if (mergedConfig.hasLocations()) {
|
if (mergedConfig.hasLocations()) {
|
||||||
String msg = String.format(
|
String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'locations' " +
|
||||||
"Test class [%s] has been configured with @ContextConfiguration's 'locations' (or 'value') attribute %s, "
|
"(or 'value') attribute %s, but %s does not support resource locations.",
|
||||||
+ "but %s does not support resource locations.", mergedConfig.getTestClass().getName(),
|
mergedConfig.getTestClass().getName(), ObjectUtils.nullSafeToString(mergedConfig.getLocations()),
|
||||||
ObjectUtils.nullSafeToString(mergedConfig.getLocations()), getClass().getSimpleName());
|
getClass().getSimpleName());
|
||||||
logger.error(msg);
|
logger.error(msg);
|
||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
|
@ -171,18 +167,14 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
/**
|
/**
|
||||||
* Register classes in the supplied {@link GenericApplicationContext context}
|
* Register classes in the supplied {@link GenericApplicationContext context}
|
||||||
* from the classes in the supplied {@link MergedContextConfiguration}.
|
* from the classes in the supplied {@link MergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>Each class must represent an <em>annotated class</em>. An
|
* <p>Each class must represent an <em>annotated class</em>. An
|
||||||
* {@link AnnotatedBeanDefinitionReader} is used to register the appropriate
|
* {@link AnnotatedBeanDefinitionReader} is used to register the appropriate
|
||||||
* bean definitions.
|
* bean definitions.
|
||||||
*
|
|
||||||
* <p>Note that this method does not call {@link #createBeanDefinitionReader}
|
* <p>Note that this method does not call {@link #createBeanDefinitionReader}
|
||||||
* since {@code AnnotatedBeanDefinitionReader} is not an instance of
|
* since {@code AnnotatedBeanDefinitionReader} is not an instance of
|
||||||
* {@link BeanDefinitionReader}.
|
* {@link BeanDefinitionReader}.
|
||||||
*
|
|
||||||
* @param context the context in which the annotated classes should be registered
|
* @param context the context in which the annotated classes should be registered
|
||||||
* @param mergedConfig the merged configuration from which the classes should be retrieved
|
* @param mergedConfig the merged configuration from which the classes should be retrieved
|
||||||
*
|
|
||||||
* @see AbstractGenericContextLoader#loadBeanDefinitions
|
* @see AbstractGenericContextLoader#loadBeanDefinitions
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -199,10 +191,9 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see #loadBeanDefinitions
|
* @see #loadBeanDefinitions
|
||||||
* @see AbstractGenericContextLoader#createBeanDefinitionReader
|
* @see AbstractGenericContextLoader#createBeanDefinitionReader
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
|
protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -39,7 +39,6 @@ public class GenericGroovyXmlContextLoader extends GenericXmlContextLoader {
|
||||||
* Load bean definitions into the supplied {@link GenericApplicationContext context}
|
* Load bean definitions into the supplied {@link GenericApplicationContext context}
|
||||||
* from the locations in the supplied {@code MergedContextConfiguration} using a
|
* from the locations in the supplied {@code MergedContextConfiguration} using a
|
||||||
* {@link GroovyBeanDefinitionReader}.
|
* {@link GroovyBeanDefinitionReader}.
|
||||||
*
|
|
||||||
* @param context the context into which the bean definitions should be loaded
|
* @param context the context into which the bean definitions should be loaded
|
||||||
* @param mergedConfig the merged context configuration
|
* @param mergedConfig the merged context configuration
|
||||||
* @see org.springframework.test.context.support.AbstractGenericContextLoader#loadBeanDefinitions
|
* @see org.springframework.test.context.support.AbstractGenericContextLoader#loadBeanDefinitions
|
||||||
|
@ -63,7 +62,7 @@ public class GenericGroovyXmlContextLoader extends GenericXmlContextLoader {
|
||||||
* resource types for detection of defaults. Consequently, this method
|
* resource types for detection of defaults. Consequently, this method
|
||||||
* is not supported.
|
* is not supported.
|
||||||
* @see #getResourceSuffixes()
|
* @see #getResourceSuffixes()
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getResourceSuffix() {
|
protected String getResourceSuffix() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -63,14 +63,12 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
protected static final Log logger = LogFactory.getLog(AbstractGenericWebContextLoader.class);
|
protected static final Log logger = LogFactory.getLog(AbstractGenericWebContextLoader.class);
|
||||||
|
|
||||||
|
|
||||||
// --- SmartContextLoader -----------------------------------------------
|
// SmartContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a Spring {@link WebApplicationContext} from the supplied
|
* Load a Spring {@link WebApplicationContext} from the supplied
|
||||||
* {@link MergedContextConfiguration}.
|
* {@link MergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>Implementation details:
|
* <p>Implementation details:
|
||||||
*
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Calls {@link #validateMergedContextConfiguration(WebMergedContextConfiguration)}
|
* <li>Calls {@link #validateMergedContextConfiguration(WebMergedContextConfiguration)}
|
||||||
* to allow subclasses to validate the supplied configuration before proceeding.</li>
|
* to allow subclasses to validate the supplied configuration before proceeding.</li>
|
||||||
|
@ -97,16 +95,15 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
||||||
* context and registers a JVM shutdown hook for it.</li>
|
* context and registers a JVM shutdown hook for it.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
|
||||||
* @return a new web application context
|
* @return a new web application context
|
||||||
* @see org.springframework.test.context.SmartContextLoader#loadContext(MergedContextConfiguration)
|
* @see org.springframework.test.context.SmartContextLoader#loadContext(MergedContextConfiguration)
|
||||||
* @see GenericWebApplicationContext
|
* @see GenericWebApplicationContext
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
||||||
Assert.isTrue(mergedConfig instanceof WebMergedContextConfiguration, () -> String.format(
|
Assert.isTrue(mergedConfig instanceof WebMergedContextConfiguration,
|
||||||
"Cannot load WebApplicationContext from non-web merged context configuration %s. "
|
() -> String.format("Cannot load WebApplicationContext from non-web merged context configuration %s. " +
|
||||||
+ "Consider annotating your test class with @WebAppConfiguration.", mergedConfig));
|
"Consider annotating your test class with @WebAppConfiguration.", mergedConfig));
|
||||||
|
|
||||||
WebMergedContextConfiguration webMergedConfig = (WebMergedContextConfiguration) mergedConfig;
|
WebMergedContextConfiguration webMergedConfig = (WebMergedContextConfiguration) mergedConfig;
|
||||||
|
|
||||||
|
@ -150,20 +147,15 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures web resources for the supplied web application context (WAC).
|
* Configures web resources for the supplied web application context (WAC).
|
||||||
*
|
|
||||||
* <h4>Implementation Details</h4>
|
* <h4>Implementation Details</h4>
|
||||||
*
|
|
||||||
* <p>If the supplied WAC has no parent or its parent is not a WAC, the
|
* <p>If the supplied WAC has no parent or its parent is not a WAC, the
|
||||||
* supplied WAC will be configured as the Root WAC (see "<em>Root WAC
|
* supplied WAC will be configured as the Root WAC (see "<em>Root WAC
|
||||||
* Configuration</em>" below).
|
* Configuration</em>" below).
|
||||||
*
|
|
||||||
* <p>Otherwise the context hierarchy of the supplied WAC will be traversed
|
* <p>Otherwise the context hierarchy of the supplied WAC will be traversed
|
||||||
* to find the top-most WAC (i.e., the root); and the {@link ServletContext}
|
* to find the top-most WAC (i.e., the root); and the {@link ServletContext}
|
||||||
* of the Root WAC will be set as the {@code ServletContext} for the supplied
|
* of the Root WAC will be set as the {@code ServletContext} for the supplied
|
||||||
* WAC.
|
* WAC.
|
||||||
*
|
|
||||||
* <h4>Root WAC Configuration</h4>
|
* <h4>Root WAC Configuration</h4>
|
||||||
*
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>The resource base path is retrieved from the supplied
|
* <li>The resource base path is retrieved from the supplied
|
||||||
* {@code WebMergedContextConfiguration}.</li>
|
* {@code WebMergedContextConfiguration}.</li>
|
||||||
|
@ -178,24 +170,20 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
* {@link WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE} key.</li>
|
* {@link WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE} key.</li>
|
||||||
* <li>Finally, the {@code MockServletContext} is set in the
|
* <li>Finally, the {@code MockServletContext} is set in the
|
||||||
* {@code WebApplicationContext}.</li>
|
* {@code WebApplicationContext}.</li>
|
||||||
*
|
* @param context the web application context for which to configure the web resources
|
||||||
* @param context the web application context for which to configure the web
|
* @param webMergedConfig the merged context configuration to use to load the web application context
|
||||||
* resources
|
|
||||||
* @param webMergedConfig the merged context configuration to use to load the
|
|
||||||
* web application context
|
|
||||||
*/
|
*/
|
||||||
protected void configureWebResources(GenericWebApplicationContext context,
|
protected void configureWebResources(GenericWebApplicationContext context,
|
||||||
WebMergedContextConfiguration webMergedConfig) {
|
WebMergedContextConfiguration webMergedConfig) {
|
||||||
|
|
||||||
ApplicationContext parent = context.getParent();
|
ApplicationContext parent = context.getParent();
|
||||||
|
|
||||||
// if the WAC has no parent or the parent is not a WAC, set the WAC as
|
// If the WebApplicationContext has no parent or the parent is not a WebApplicationContext,
|
||||||
// the Root WAC:
|
// set the current context as the root WebApplicationContext:
|
||||||
if (parent == null || (!(parent instanceof WebApplicationContext))) {
|
if (parent == null || (!(parent instanceof WebApplicationContext))) {
|
||||||
String resourceBasePath = webMergedConfig.getResourceBasePath();
|
String resourceBasePath = webMergedConfig.getResourceBasePath();
|
||||||
ResourceLoader resourceLoader = resourceBasePath.startsWith(ResourceLoader.CLASSPATH_URL_PREFIX) ? new DefaultResourceLoader()
|
ResourceLoader resourceLoader = (resourceBasePath.startsWith(ResourceLoader.CLASSPATH_URL_PREFIX) ?
|
||||||
: new FileSystemResourceLoader();
|
new DefaultResourceLoader() : new FileSystemResourceLoader());
|
||||||
|
|
||||||
ServletContext servletContext = new MockServletContext(resourceBasePath, resourceLoader);
|
ServletContext servletContext = new MockServletContext(resourceBasePath, resourceLoader);
|
||||||
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
|
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
|
||||||
context.setServletContext(servletContext);
|
context.setServletContext(servletContext);
|
||||||
|
@ -203,7 +191,7 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
else {
|
else {
|
||||||
ServletContext servletContext = null;
|
ServletContext servletContext = null;
|
||||||
|
|
||||||
// find the Root WAC
|
// Find the root WebApplicationContext
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
if (parent instanceof WebApplicationContext && !(parent.getParent() instanceof WebApplicationContext)) {
|
if (parent instanceof WebApplicationContext && !(parent.getParent() instanceof WebApplicationContext)) {
|
||||||
servletContext = ((WebApplicationContext) parent).getServletContext();
|
servletContext = ((WebApplicationContext) parent).getServletContext();
|
||||||
|
@ -219,10 +207,8 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
/**
|
/**
|
||||||
* Customize the internal bean factory of the {@code WebApplicationContext}
|
* Customize the internal bean factory of the {@code WebApplicationContext}
|
||||||
* created by this context loader.
|
* created by this context loader.
|
||||||
*
|
|
||||||
* <p>The default implementation is empty but can be overridden in subclasses
|
* <p>The default implementation is empty but can be overridden in subclasses
|
||||||
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
||||||
*
|
|
||||||
* @param beanFactory the bean factory created by this context loader
|
* @param beanFactory the bean factory created by this context loader
|
||||||
* @param webMergedConfig the merged context configuration to use to load the
|
* @param webMergedConfig the merged context configuration to use to load the
|
||||||
* web application context
|
* web application context
|
||||||
|
@ -232,52 +218,50 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||||
* @see DefaultListableBeanFactory#setAllowCircularReferences
|
* @see DefaultListableBeanFactory#setAllowCircularReferences
|
||||||
* @see DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping
|
* @see DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping
|
||||||
*/
|
*/
|
||||||
protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory,
|
protected void customizeBeanFactory(
|
||||||
WebMergedContextConfiguration webMergedConfig) {
|
DefaultListableBeanFactory beanFactory, WebMergedContextConfiguration webMergedConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
|
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
|
||||||
* from the locations or classes in the supplied {@code WebMergedContextConfiguration}.
|
* from the locations or classes in the supplied {@code WebMergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>Concrete subclasses must provide an appropriate implementation.
|
* <p>Concrete subclasses must provide an appropriate implementation.
|
||||||
*
|
|
||||||
* @param context the context into which the bean definitions should be loaded
|
* @param context the context into which the bean definitions should be loaded
|
||||||
* @param webMergedConfig the merged context configuration to use to load the
|
* @param webMergedConfig the merged context configuration to use to load the
|
||||||
* web application context
|
* web application context
|
||||||
* @see #loadContext(MergedContextConfiguration)
|
* @see #loadContext(MergedContextConfiguration)
|
||||||
*/
|
*/
|
||||||
protected abstract void loadBeanDefinitions(GenericWebApplicationContext context,
|
protected abstract void loadBeanDefinitions(
|
||||||
WebMergedContextConfiguration webMergedConfig);
|
GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize the {@link GenericWebApplicationContext} created by this context
|
* Customize the {@link GenericWebApplicationContext} created by this context
|
||||||
* loader <i>after</i> bean definitions have been loaded into the context but
|
* loader <i>after</i> bean definitions have been loaded into the context but
|
||||||
* <i>before</i> the context is refreshed.
|
* <i>before</i> the context is refreshed.
|
||||||
*
|
|
||||||
* <p>The default implementation simply delegates to
|
* <p>The default implementation simply delegates to
|
||||||
* {@link AbstractContextLoader#customizeContext(ConfigurableApplicationContext, MergedContextConfiguration)}.
|
* {@link AbstractContextLoader#customizeContext(ConfigurableApplicationContext, MergedContextConfiguration)}.
|
||||||
*
|
|
||||||
* @param context the newly created web application context
|
* @param context the newly created web application context
|
||||||
* @param webMergedConfig the merged context configuration to use to load the
|
* @param webMergedConfig the merged context configuration to use to load the
|
||||||
* web application context
|
* web application context
|
||||||
* @see #loadContext(MergedContextConfiguration)
|
* @see #loadContext(MergedContextConfiguration)
|
||||||
* @see #customizeContext(ConfigurableApplicationContext, MergedContextConfiguration)
|
* @see #customizeContext(ConfigurableApplicationContext, MergedContextConfiguration)
|
||||||
*/
|
*/
|
||||||
protected void customizeContext(GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) {
|
protected void customizeContext(
|
||||||
|
GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) {
|
||||||
|
|
||||||
super.customizeContext(context, webMergedConfig);
|
super.customizeContext(context, webMergedConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ContextLoader -------------------------------------------------------
|
|
||||||
|
// ContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code AbstractGenericWebContextLoader} should be used as a
|
* {@code AbstractGenericWebContextLoader} should be used as a
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
|
||||||
* @see org.springframework.test.context.ContextLoader#loadContext(java.lang.String[])
|
* @see org.springframework.test.context.ContextLoader#loadContext(java.lang.String[])
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final ApplicationContext loadContext(String... locations) throws Exception {
|
public final ApplicationContext loadContext(String... locations) throws Exception {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -59,11 +59,10 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
private static final Log logger = LogFactory.getLog(AnnotationConfigWebContextLoader.class);
|
private static final Log logger = LogFactory.getLog(AnnotationConfigWebContextLoader.class);
|
||||||
|
|
||||||
|
|
||||||
// --- SmartContextLoader -----------------------------------------------
|
// SmartContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
||||||
*
|
|
||||||
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
||||||
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
||||||
* {@code SmartContextLoader} will attempt to {@linkplain
|
* {@code SmartContextLoader} will attempt to {@linkplain
|
||||||
|
@ -72,7 +71,6 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
||||||
* supplied configuration attributes. Otherwise, properties in the supplied
|
* supplied configuration attributes. Otherwise, properties in the supplied
|
||||||
* configuration attributes will not be modified.
|
* configuration attributes will not be modified.
|
||||||
*
|
|
||||||
* @param configAttributes the context configuration attributes to process
|
* @param configAttributes the context configuration attributes to process
|
||||||
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
|
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
|
||||||
* @see #isGenerateDefaultLocations()
|
* @see #isGenerateDefaultLocations()
|
||||||
|
@ -87,29 +85,26 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect the default configuration classes for the supplied test class.
|
* Detect the default configuration classes for the supplied test class.
|
||||||
*
|
|
||||||
* <p>The default implementation simply delegates to
|
* <p>The default implementation simply delegates to
|
||||||
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses(Class)}.
|
* {@link AnnotationConfigContextLoaderUtils#detectDefaultConfigurationClasses(Class)}.
|
||||||
*
|
|
||||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||||
* @return an array of default configuration classes, potentially empty but
|
* @return an array of default configuration classes, potentially empty but never {@code null}
|
||||||
* never {@code null}
|
|
||||||
* @see AnnotationConfigContextLoaderUtils
|
* @see AnnotationConfigContextLoaderUtils
|
||||||
*/
|
*/
|
||||||
protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
||||||
return AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(declaringClass);
|
return AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(declaringClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AbstractContextLoader -----------------------------------------------
|
|
||||||
|
// AbstractContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code AnnotationConfigWebContextLoader} should be used as a
|
* {@code AnnotationConfigWebContextLoader} should be used as a
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see org.springframework.test.context.support.AbstractContextLoader#modifyLocations
|
* @see org.springframework.test.context.support.AbstractContextLoader#modifyLocations
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String[] modifyLocations(Class<?> clazz, String... locations) {
|
protected String[] modifyLocations(Class<?> clazz, String... locations) {
|
||||||
|
@ -122,9 +117,8 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see org.springframework.test.context.support.AbstractContextLoader#generateDefaultLocations
|
* @see org.springframework.test.context.support.AbstractContextLoader#generateDefaultLocations
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String[] generateDefaultLocations(Class<?> clazz) {
|
protected String[] generateDefaultLocations(Class<?> clazz) {
|
||||||
|
@ -137,9 +131,8 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||||
* Consequently, this method is not supported.
|
* Consequently, this method is not supported.
|
||||||
*
|
* @throws UnsupportedOperationException in this implementation
|
||||||
* @see org.springframework.test.context.support.AbstractContextLoader#getResourceSuffix
|
* @see org.springframework.test.context.support.AbstractContextLoader#getResourceSuffix
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getResourceSuffix() {
|
protected String getResourceSuffix() {
|
||||||
|
@ -147,24 +140,23 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
"AnnotationConfigWebContextLoader does not support the getResourceSuffix() method");
|
"AnnotationConfigWebContextLoader does not support the getResourceSuffix() method");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AbstractGenericWebContextLoader -------------------------------------
|
|
||||||
|
// AbstractGenericWebContextLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register classes in the supplied {@linkplain GenericWebApplicationContext context}
|
* Register classes in the supplied {@linkplain GenericWebApplicationContext context}
|
||||||
* from the classes in the supplied {@link WebMergedContextConfiguration}.
|
* from the classes in the supplied {@link WebMergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>Each class must represent an <em>annotated class</em>. An
|
* <p>Each class must represent an <em>annotated class</em>. An
|
||||||
* {@link AnnotatedBeanDefinitionReader} is used to register the appropriate
|
* {@link AnnotatedBeanDefinitionReader} is used to register the appropriate
|
||||||
* bean definitions.
|
* bean definitions.
|
||||||
*
|
|
||||||
* @param context the context in which the annotated classes should be registered
|
* @param context the context in which the annotated classes should be registered
|
||||||
* @param webMergedConfig the merged configuration from which the classes should be retrieved
|
* @param webMergedConfig the merged configuration from which the classes should be retrieved
|
||||||
*
|
|
||||||
* @see AbstractGenericWebContextLoader#loadBeanDefinitions
|
* @see AbstractGenericWebContextLoader#loadBeanDefinitions
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void loadBeanDefinitions(GenericWebApplicationContext context,
|
protected void loadBeanDefinitions(
|
||||||
WebMergedContextConfiguration webMergedConfig) {
|
GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) {
|
||||||
|
|
||||||
Class<?>[] annotatedClasses = webMergedConfig.getClasses();
|
Class<?>[] annotatedClasses = webMergedConfig.getClasses();
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Registering annotated classes: " + ObjectUtils.nullSafeToString(annotatedClasses));
|
logger.debug("Registering annotated classes: " + ObjectUtils.nullSafeToString(annotatedClasses));
|
||||||
|
@ -181,9 +173,9 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||||
@Override
|
@Override
|
||||||
protected void validateMergedContextConfiguration(WebMergedContextConfiguration webMergedConfig) {
|
protected void validateMergedContextConfiguration(WebMergedContextConfiguration webMergedConfig) {
|
||||||
if (webMergedConfig.hasLocations()) {
|
if (webMergedConfig.hasLocations()) {
|
||||||
String msg = String.format(
|
String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'locations' " +
|
||||||
"Test class [%s] has been configured with @ContextConfiguration's 'locations' (or 'value') attribute %s, "
|
"(or 'value') attribute %s, but %s does not support resource locations.",
|
||||||
+ "but %s does not support resource locations.", webMergedConfig.getTestClass().getName(),
|
webMergedConfig.getTestClass().getName(),
|
||||||
ObjectUtils.nullSafeToString(webMergedConfig.getLocations()), getClass().getSimpleName());
|
ObjectUtils.nullSafeToString(webMergedConfig.getLocations()), getClass().getSimpleName());
|
||||||
logger.error(msg);
|
logger.error(msg);
|
||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -38,7 +38,6 @@ public class GenericGroovyXmlWebContextLoader extends GenericXmlWebContextLoader
|
||||||
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
|
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
|
||||||
* from the locations in the supplied {@code WebMergedContextConfiguration} using a
|
* from the locations in the supplied {@code WebMergedContextConfiguration} using a
|
||||||
* {@link GroovyBeanDefinitionReader}.
|
* {@link GroovyBeanDefinitionReader}.
|
||||||
*
|
|
||||||
* @param context the context into which the bean definitions should be loaded
|
* @param context the context into which the bean definitions should be loaded
|
||||||
* @param webMergedConfig the merged context configuration
|
* @param webMergedConfig the merged context configuration
|
||||||
* @see AbstractGenericWebContextLoader#loadBeanDefinitions
|
* @see AbstractGenericWebContextLoader#loadBeanDefinitions
|
||||||
|
@ -63,7 +62,7 @@ public class GenericGroovyXmlWebContextLoader extends GenericXmlWebContextLoader
|
||||||
* resource types for detection of defaults. Consequently, this method
|
* resource types for detection of defaults. Consequently, this method
|
||||||
* is not supported.
|
* is not supported.
|
||||||
* @see #getResourceSuffixes()
|
* @see #getResourceSuffixes()
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException in this implementation
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getResourceSuffix() {
|
protected String getResourceSuffix() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -45,7 +45,7 @@ class MockServerContainer implements ServerContainer {
|
||||||
private int defaultMaxTextMessageBufferSize;
|
private int defaultMaxTextMessageBufferSize;
|
||||||
|
|
||||||
|
|
||||||
// --- WebSocketContainer --------------------------------------------------
|
// WebSocketContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDefaultAsyncSendTimeout() {
|
public long getDefaultAsyncSendTimeout() {
|
||||||
|
@ -119,7 +119,7 @@ class MockServerContainer implements ServerContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- ServerContainer -----------------------------------------------------
|
// ServerContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addEndpoint(Class<?> endpointClass) throws DeploymentException {
|
public void addEndpoint(Class<?> endpointClass) throws DeploymentException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -63,7 +63,7 @@ public class XpathExpectationsHelper {
|
||||||
* @param namespaces XML namespaces referenced in the XPath expression, or {@code null}
|
* @param namespaces XML namespaces referenced in the XPath expression, or {@code null}
|
||||||
* @param args arguments to parameterize the XPath expression with using the
|
* @param args arguments to parameterize the XPath expression with using the
|
||||||
* formatting specifiers defined in {@link String#format(String, Object...)}
|
* formatting specifiers defined in {@link String#format(String, Object...)}
|
||||||
* @throws XPathExpressionException
|
* @throws XPathExpressionException if expression compilation failed
|
||||||
*/
|
*/
|
||||||
public XpathExpectationsHelper(String expression, @Nullable Map<String, String> namespaces, Object... args)
|
public XpathExpectationsHelper(String expression, @Nullable Map<String, String> namespaces, Object... args)
|
||||||
throws XPathExpressionException {
|
throws XPathExpressionException {
|
||||||
|
@ -78,7 +78,7 @@ public class XpathExpectationsHelper {
|
||||||
throws XPathExpressionException {
|
throws XPathExpressionException {
|
||||||
|
|
||||||
SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
|
SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
|
||||||
namespaceContext.setBindings((namespaces != null) ? namespaces : Collections.<String, String> emptyMap());
|
namespaceContext.setBindings(namespaces != null ? namespaces : Collections.emptyMap());
|
||||||
XPath xpath = XPathFactory.newInstance().newXPath();
|
XPath xpath = XPathFactory.newInstance().newXPath();
|
||||||
xpath.setNamespaceContext(namespaceContext);
|
xpath.setNamespaceContext(namespaceContext);
|
||||||
return xpath.compile(expression);
|
return xpath.compile(expression);
|
||||||
|
@ -122,7 +122,7 @@ public class XpathExpectationsHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the XPath expression to given document.
|
* Apply the XPath expression to given document.
|
||||||
* @throws XPathExpressionException
|
* @throws XPathExpressionException if expression evaluation failed
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -18,7 +18,6 @@ package org.springframework.test.web.client.match;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
|
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
|
@ -53,7 +52,7 @@ public class XpathRequestMatchers {
|
||||||
* @param namespaces XML namespaces referenced in the XPath expression, or {@code null}
|
* @param namespaces XML namespaces referenced in the XPath expression, or {@code null}
|
||||||
* @param args arguments to parameterize the XPath expression with using the
|
* @param args arguments to parameterize the XPath expression with using the
|
||||||
* formatting specifiers defined in {@link String#format(String, Object...)}
|
* formatting specifiers defined in {@link String#format(String, Object...)}
|
||||||
* @throws XPathExpressionException
|
* @throws XPathExpressionException if expression compilation failed
|
||||||
*/
|
*/
|
||||||
protected XpathRequestMatchers(String expression, @Nullable Map<String, String> namespaces, Object ... args)
|
protected XpathRequestMatchers(String expression, @Nullable Map<String, String> namespaces, Object ... args)
|
||||||
throws XPathExpressionException {
|
throws XPathExpressionException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -184,7 +184,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
|
||||||
* This implementation delegates to a SavepointManager for the
|
* This implementation delegates to a SavepointManager for the
|
||||||
* underlying transaction, if possible.
|
* underlying transaction, if possible.
|
||||||
* @see #getSavepointManager()
|
* @see #getSavepointManager()
|
||||||
* @see org.springframework.transaction.SavepointManager
|
* @see SavepointManager#createSavepoint()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object createSavepoint() throws TransactionException {
|
public Object createSavepoint() throws TransactionException {
|
||||||
|
@ -194,9 +194,8 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
|
||||||
/**
|
/**
|
||||||
* This implementation delegates to a SavepointManager for the
|
* This implementation delegates to a SavepointManager for the
|
||||||
* underlying transaction, if possible.
|
* underlying transaction, if possible.
|
||||||
* @throws org.springframework.transaction.NestedTransactionNotSupportedException
|
|
||||||
* @see #getSavepointManager()
|
* @see #getSavepointManager()
|
||||||
* @see org.springframework.transaction.SavepointManager
|
* @see SavepointManager#rollbackToSavepoint(Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void rollbackToSavepoint(Object savepoint) throws TransactionException {
|
public void rollbackToSavepoint(Object savepoint) throws TransactionException {
|
||||||
|
@ -207,7 +206,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
|
||||||
* This implementation delegates to a SavepointManager for the
|
* This implementation delegates to a SavepointManager for the
|
||||||
* underlying transaction, if possible.
|
* underlying transaction, if possible.
|
||||||
* @see #getSavepointManager()
|
* @see #getSavepointManager()
|
||||||
* @see org.springframework.transaction.SavepointManager
|
* @see SavepointManager#releaseSavepoint(Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void releaseSavepoint(Object savepoint) throws TransactionException {
|
public void releaseSavepoint(Object savepoint) throws TransactionException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -83,7 +83,8 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an empty directive.
|
* Return an empty directive.
|
||||||
* <p>This is well suited for using other optional directives without "max-age", "no-cache" or "no-store".
|
* <p>This is well suited for using other optional directives without "max-age",
|
||||||
|
* "no-cache" or "no-store".
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
*/
|
*/
|
||||||
public static CacheControl empty() {
|
public static CacheControl empty() {
|
||||||
|
@ -92,11 +93,13 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "max-age=" directive.
|
* Add a "max-age=" directive.
|
||||||
* <p>This directive is well suited for publicly caching resources, knowing that they won't change within
|
* <p>This directive is well suited for publicly caching resources, knowing that
|
||||||
* the configured amount of time. Additional directives can be also used, in case resources shouldn't be
|
* they won't change within the configured amount of time. Additional directives
|
||||||
* cached ({@link #cachePrivate()}) or transformed ({@link #noTransform()}) by shared caches.
|
* can be also used, in case resources shouldn't be cached ({@link #cachePrivate()})
|
||||||
* <p>In order to prevent caches to reuse the cached response even when it has become stale
|
* or transformed ({@link #noTransform()}) by shared caches.
|
||||||
* (i.e. the "max-age" delay is passed), the "must-revalidate" directive should be set ({@link #mustRevalidate()}
|
* <p>In order to prevent caches to reuse the cached response even when it has
|
||||||
|
* become stale (i.e. the "max-age" delay is passed), the "must-revalidate"
|
||||||
|
* directive should be set ({@link #mustRevalidate()}
|
||||||
* @param maxAge the maximum time the response should be cached
|
* @param maxAge the maximum time the response should be cached
|
||||||
* @param unit the time unit of the {@code maxAge} argument
|
* @param unit the time unit of the {@code maxAge} argument
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
|
@ -110,12 +113,13 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "no-cache" directive.
|
* Add a "no-cache" directive.
|
||||||
* <p>This directive is well suited for telling caches that the response can be reused only if the client
|
* <p>This directive is well suited for telling caches that the response
|
||||||
* revalidates it with the server. This directive won't disable cache altogether and may result with
|
* can be reused only if the client revalidates it with the server.
|
||||||
* clients sending conditional requests (with "ETag", "If-Modified-Since" headers) and the server responding
|
* This directive won't disable cache altogether and may result with clients
|
||||||
* with "304 - Not Modified" status.
|
* sending conditional requests (with "ETag", "If-Modified-Since" headers)
|
||||||
* <p>In order to disable caching and minimize requests/responses exchanges, the {@link #noStore()} directive
|
* and the server responding with "304 - Not Modified" status.
|
||||||
* should be used instead of {@link #noCache()}.
|
* <p>In order to disable caching and minimize requests/responses exchanges,
|
||||||
|
* the {@link #noStore()} directive should be used instead of {@code #noCache()}.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a>
|
||||||
*/
|
*/
|
||||||
|
@ -127,7 +131,8 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "no-store" directive.
|
* Add a "no-store" directive.
|
||||||
* <p>This directive is well suited for preventing caches (browsers and proxies) to cache the content of responses.
|
* <p>This directive is well suited for preventing caches (browsers and proxies)
|
||||||
|
* to cache the content of responses.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a>
|
||||||
*/
|
*/
|
||||||
|
@ -140,8 +145,9 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "must-revalidate" directive.
|
* Add a "must-revalidate" directive.
|
||||||
* <p>This directive indicates that once it has become stale, a cache MUST NOT use the response
|
* <p>This directive indicates that once it has become stale, a cache MUST NOT
|
||||||
* to satisfy subsequent requests without successful validation on the origin server.
|
* use the response to satisfy subsequent requests without successful validation
|
||||||
|
* on the origin server.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.1">rfc7234 section 5.2.2.1</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.1">rfc7234 section 5.2.2.1</a>
|
||||||
*/
|
*/
|
||||||
|
@ -152,8 +158,9 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "no-transform" directive.
|
* Add a "no-transform" directive.
|
||||||
* <p>This directive indicates that intermediaries (caches and others) should not transform the response content.
|
* <p>This directive indicates that intermediaries (caches and others) should
|
||||||
* This can be useful to force caches and CDNs not to automatically gzip or optimize the response content.
|
* not transform the response content. This can be useful to force caches and
|
||||||
|
* CDNs not to automatically gzip or optimize the response content.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.4">rfc7234 section 5.2.2.4</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.4">rfc7234 section 5.2.2.4</a>
|
||||||
*/
|
*/
|
||||||
|
@ -164,8 +171,9 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "public" directive.
|
* Add a "public" directive.
|
||||||
* <p>This directive indicates that any cache MAY store the response, even if the response
|
* <p>This directive indicates that any cache MAY store the response,
|
||||||
* would normally be non-cacheable or cacheable only within a private cache.
|
* even if the response would normally be non-cacheable or cacheable
|
||||||
|
* only within a private cache.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.5">rfc7234 section 5.2.2.5</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.5">rfc7234 section 5.2.2.5</a>
|
||||||
*/
|
*/
|
||||||
|
@ -176,8 +184,8 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "private" directive.
|
* Add a "private" directive.
|
||||||
* <p>This directive indicates that the response message is intended for a single user
|
* <p>This directive indicates that the response message is intended
|
||||||
* and MUST NOT be stored by a shared cache.
|
* for a single user and MUST NOT be stored by a shared cache.
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.6">rfc7234 section 5.2.2.6</a>
|
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.6">rfc7234 section 5.2.2.6</a>
|
||||||
*/
|
*/
|
||||||
|
@ -200,8 +208,8 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an "s-maxage" directive.
|
* Add an "s-maxage" directive.
|
||||||
* <p>This directive indicates that, in shared caches, the maximum age specified by this directive
|
* <p>This directive indicates that, in shared caches, the maximum age specified
|
||||||
* overrides the maximum age specified by other directives.
|
* by this directive overrides the maximum age specified by other directives.
|
||||||
* @param sMaxAge the maximum time the response should be cached
|
* @param sMaxAge the maximum time the response should be cached
|
||||||
* @param unit the time unit of the {@code sMaxAge} argument
|
* @param unit the time unit of the {@code sMaxAge} argument
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
|
@ -214,10 +222,11 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "stale-while-revalidate" directive.
|
* Add a "stale-while-revalidate" directive.
|
||||||
* <p>This directive indicates that caches MAY serve the response in
|
* <p>This directive indicates that caches MAY serve the response in which it
|
||||||
* which it appears after it becomes stale, up to the indicated number of seconds.
|
* appears after it becomes stale, up to the indicated number of seconds.
|
||||||
* If a cached response is served stale due to the presence of this extension,
|
* If a cached response is served stale due to the presence of this extension,
|
||||||
* the cache SHOULD attempt to revalidate it while still serving stale responses (i.e., without blocking).
|
* the cache SHOULD attempt to revalidate it while still serving stale responses
|
||||||
|
* (i.e. without blocking).
|
||||||
* @param staleWhileRevalidate the maximum time the response should be used while being revalidated
|
* @param staleWhileRevalidate the maximum time the response should be used while being revalidated
|
||||||
* @param unit the time unit of the {@code staleWhileRevalidate} argument
|
* @param unit the time unit of the {@code staleWhileRevalidate} argument
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
|
@ -230,8 +239,8 @@ public class CacheControl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a "stale-if-error" directive.
|
* Add a "stale-if-error" directive.
|
||||||
* <p>This directive indicates that when an error is encountered, a cached stale response MAY be used to satisfy
|
* <p>This directive indicates that when an error is encountered, a cached stale response
|
||||||
* the request, regardless of other freshness information.
|
* MAY be used to satisfy the request, regardless of other freshness information.
|
||||||
* @param staleIfError the maximum time the response should be used when errors are encountered
|
* @param staleIfError the maximum time the response should be used when errors are encountered
|
||||||
* @param unit the time unit of the {@code staleIfError} argument
|
* @param unit the time unit of the {@code staleIfError} argument
|
||||||
* @return {@code this}, to facilitate method chaining
|
* @return {@code this}, to facilitate method chaining
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -48,7 +48,7 @@ public interface ClientCodecConfigurer extends CodecConfigurer {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link DefaultCodecs} with extra client options.
|
* Extension of {@link CodecConfigurer.DefaultCodecs} with extra client options.
|
||||||
*/
|
*/
|
||||||
interface ClientDefaultCodecs extends DefaultCodecs {
|
interface ClientDefaultCodecs extends DefaultCodecs {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -47,7 +47,7 @@ public interface ServerCodecConfigurer extends CodecConfigurer {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link DefaultCodecs} with extra server options.
|
* Extension of {@link CodecConfigurer.DefaultCodecs} with extra server options.
|
||||||
*/
|
*/
|
||||||
interface ServerDefaultCodecs extends DefaultCodecs {
|
interface ServerDefaultCodecs extends DefaultCodecs {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -73,11 +73,10 @@ public class LocalJaxWsServiceFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the WSDL document URL as a {@link Resource}.
|
* Set the WSDL document URL as a {@link Resource}.
|
||||||
* @throws IOException
|
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public void setWsdlDocumentResource(Resource wsdlDocumentResource) throws IOException {
|
public void setWsdlDocumentResource(Resource wsdlDocumentResource) throws IOException {
|
||||||
Assert.notNull(wsdlDocumentResource, "WSDL Resource must not be null.");
|
Assert.notNull(wsdlDocumentResource, "WSDL Resource must not be null");
|
||||||
this.wsdlDocumentUrl = wsdlDocumentResource.getURL();
|
this.wsdlDocumentUrl = wsdlDocumentResource.getURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -292,19 +292,17 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||||
* If multiple matches are found, the best match is selected.
|
* If multiple matches are found, the best match is selected.
|
||||||
* @param exchange the current exchange
|
* @param exchange the current exchange
|
||||||
* @return the best-matching handler method, or {@code null} if no match
|
* @return the best-matching handler method, or {@code null} if no match
|
||||||
* @see #handleMatch(T, HandlerMethod, ServerWebExchange)
|
* @see #handleMatch
|
||||||
* @see #handleNoMatch(Set, ServerWebExchange)
|
* @see #handleNoMatch
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
protected HandlerMethod lookupHandlerMethod(ServerWebExchange exchange)
|
protected HandlerMethod lookupHandlerMethod(ServerWebExchange exchange) throws Exception {
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
List<Match> matches = new ArrayList<>();
|
List<Match> matches = new ArrayList<>();
|
||||||
addMatchingMappings(this.mappingRegistry.getMappings().keySet(), matches, exchange);
|
addMatchingMappings(this.mappingRegistry.getMappings().keySet(), matches, exchange);
|
||||||
|
|
||||||
if (!matches.isEmpty()) {
|
if (!matches.isEmpty()) {
|
||||||
Comparator<Match> comparator = new MatchComparator(getMappingComparator(exchange));
|
Comparator<Match> comparator = new MatchComparator(getMappingComparator(exchange));
|
||||||
Collections.sort(matches, comparator);
|
matches.sort(comparator);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Found " + matches.size() + " matching mapping(s) for [" +
|
logger.trace("Found " + matches.size() + " matching mapping(s) for [" +
|
||||||
exchange.getRequest().getPath() + "] : " + matches);
|
exchange.getRequest().getPath() + "] : " + matches);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.web.reactive.result.method.annotation;
|
package org.springframework.web.reactive.result.method.annotation;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -37,14 +38,13 @@ import org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentR
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable
|
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable @MatrixVariable}
|
||||||
* @MatrixVariable} where the annotation does not specify a name. In other words
|
* where the annotation does not specify a name. In other words the purpose of this resolver
|
||||||
* the purpose of this resolver is to provide access to multiple matrix
|
* is to provide access to multiple matrix variables, either all or associted with a specific
|
||||||
* variables, either all or associted with a specific path variable.
|
* path variable.
|
||||||
*
|
*
|
||||||
* <p>When a name is specified, an argument of type Map is considered to be an
|
* <p>When a name is specified, an argument of type Map is considered to be a single attribute
|
||||||
* single attribute with a Map value, and is resolved by
|
* with a Map value, and is resolved by {@link MatrixVariableMethodArgumentResolver} instead.
|
||||||
* {@link MatrixVariableMethodArgumentResolver} instead.
|
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 5.0.1
|
* @since 5.0.1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -142,9 +142,8 @@ public class RedirectView extends AbstractUrlBasedView {
|
||||||
/**
|
/**
|
||||||
* Configure one or more hosts associated with the application.
|
* Configure one or more hosts associated with the application.
|
||||||
* All other hosts will be considered external hosts.
|
* All other hosts will be considered external hosts.
|
||||||
* <p>In effect this provides a way turn off encoding via
|
* <p>In effect this provides a way turn off encoding for URLs that
|
||||||
* {@link ServerHttpResponse#encodeUrl(String)} for URLs that have a
|
* have a host and that host is not listed as a known host.
|
||||||
* host and that host is not listed as a known host.
|
|
||||||
* <p>If not set (the default) all redirect URLs are encoded.
|
* <p>If not set (the default) all redirect URLs are encoded.
|
||||||
* @param hosts one or more application hosts
|
* @param hosts one or more application hosts
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -38,14 +38,13 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||||
import org.springframework.web.servlet.HandlerMapping;
|
import org.springframework.web.servlet.HandlerMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable
|
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable @MatrixVariable}
|
||||||
* @MatrixVariable} where the annotation does not specify a name. In other words
|
* where the annotation does not specify a name. In other words the purpose of this resolver
|
||||||
* the purpose of this resolver is to provide access to multiple matrix
|
* is to provide access to multiple matrix variables, either all or associted with a specific
|
||||||
* variables, either all or associted with a specific path variable.
|
* path variable.
|
||||||
*
|
*
|
||||||
* <p>When a name is specified, an argument of type Map is considered to be an
|
* <p>When a name is specified, an argument of type Map is considered to be a single attribute
|
||||||
* single attribute with a Map value, and is resolved by
|
* with a Map value, and is resolved by {@link MatrixVariableMethodArgumentResolver} instead.
|
||||||
* {@link MatrixVariableMethodArgumentResolver} instead.
|
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 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.
|
||||||
|
@ -233,7 +233,7 @@ public class LabelTag extends AbstractHtmlElementTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides {@link #getName()} to always return {@code null},
|
* Overrides {@code #getName()} to always return {@code null},
|
||||||
* because the '{@code name}' attribute is not supported by the
|
* because the '{@code name}' attribute is not supported by the
|
||||||
* '{@code label}' tag.
|
* '{@code label}' tag.
|
||||||
* @return the value for the HTML '{@code name}' attribute
|
* @return the value for the HTML '{@code name}' attribute
|
||||||
|
|
Loading…
Reference in New Issue