本文整理汇总了Java中org.springframework.test.context.ContextConfigurationAttributes.hasClasses方法的典型用法代码示例。如果您正苦于以下问题:Java ContextConfigurationAttributes.hasClasses方法的具体用法?Java ContextConfigurationAttributes.hasClasses怎么用?Java ContextConfigurationAttributes.hasClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.test.context.ContextConfigurationAttributes
的用法示例。
在下文中一共展示了ContextConfigurationAttributes.hasClasses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processContextConfiguration
import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
@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()));
}
}
示例2: processContextConfiguration
import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
/**
* 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()));
}
}
示例3: processContextConfiguration
import org.springframework.test.context.ContextConfigurationAttributes; //导入方法依赖的package包/类
/**
* 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()));
}
}