Java Code Examples for org.springframework.test.context.ContextConfigurationAttributes#setClasses()

The following examples show how to use org.springframework.test.context.ContextConfigurationAttributes#setClasses() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HybridContextLoader.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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()));
	}
}
 
Example 2
Source File: HybridContextLoader.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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()));
	}
}
 
Example 3
Source File: HybridContextLoader.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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()));
	}
}
 
Example 4
Source File: AnnotationConfigWebContextLoader.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * 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()));
	}
}
 
Example 5
Source File: AnnotationConfigContextLoader.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * 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()));
	}
}
 
Example 6
Source File: AnnotationConfigWebContextLoader.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * 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()));
	}
}
 
Example 7
Source File: AnnotationConfigContextLoader.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * 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()));
	}
}
 
Example 8
Source File: AnnotationConfigWebContextLoader.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * 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()));
	}
}
 
Example 9
Source File: AnnotationConfigContextLoader.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * 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()));
	}
}