下面列出了org.springframework.test.context.ContextConfigurationAttributes#setClasses ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
// Detect default XML configuration files:
super.processContextConfiguration(configAttributes);
// Detect default configuration classes:
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
// Detect default XML configuration files:
super.processContextConfiguration(configAttributes);
// Detect default configuration classes:
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
// Detect default XML configuration files:
super.processContextConfiguration(configAttributes);
// Detect default configuration classes:
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@linkplain
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@link
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@linkplain
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@link
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
*
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@linkplain
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
*
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}
/**
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
*
* <p>If the <em>annotated classes</em> are {@code null} or empty and
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
* {@code SmartContextLoader} will attempt to {@link
* #detectDefaultConfigurationClasses detect default configuration classes}.
* If defaults are detected they will be
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
* supplied configuration attributes. Otherwise, properties in the supplied
* configuration attributes will not be modified.
*
* @param configAttributes the context configuration attributes to process
* @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes)
* @see #isGenerateDefaultLocations()
* @see #detectDefaultConfigurationClasses(Class)
*/
@Override
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
if (!configAttributes.hasClasses() && isGenerateDefaultLocations()) {
configAttributes.setClasses(detectDefaultConfigurationClasses(configAttributes.getDeclaringClass()));
}
}