public abstract class

AbstractGenericContextLoader

extends AbstractContextLoader
java.lang.Object
   ↳ org.springframework.test.context.support.AbstractContextLoader
     ↳ org.springframework.test.context.support.AbstractGenericContextLoader
Known Direct Subclasses

Class Overview

Abstract, generic extension of AbstractContextLoader which loads a GenericApplicationContext from the locations provided to loadContext(String).

Concrete subclasses must provide an appropriate BeanDefinitionReader.

Summary

Fields
protected static final Log logger
Public Constructors
AbstractGenericContextLoader()
Public Methods
final ConfigurableApplicationContext loadContext(String... locations)
Loads a Spring ApplicationContext from the supplied locations.
Protected Methods
abstract BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context)
Factory method for creating new BeanDefinitionReaders for loading bean definitions into the supplied context.
void customizeBeanFactory(DefaultListableBeanFactory beanFactory)
Customize the internal bean factory of the ApplicationContext created by this ContextLoader.
void customizeContext(GenericApplicationContext context)
Customize the GenericApplicationContext created by this ContextLoader after bean definitions have been loaded into the context but before the context is refreshed.
void prepareContext(GenericApplicationContext context)
Prepare the GenericApplicationContext created by this ContextLoader.
[Expand]
Inherited Methods
From class org.springframework.test.context.support.AbstractContextLoader
From class java.lang.Object
From interface org.springframework.test.context.ContextLoader

Fields

protected static final Log logger

Public Constructors

public AbstractGenericContextLoader ()

Public Methods

public final ConfigurableApplicationContext loadContext (String... locations)

Loads a Spring ApplicationContext from the supplied locations.

Implementation details:

Subclasses must provide an appropriate implementation of createBeanDefinitionReader(GenericApplicationContext).

Returns
  • a new application context
Throws
Exception

Protected Methods

protected abstract BeanDefinitionReader createBeanDefinitionReader (GenericApplicationContext context)

Factory method for creating new BeanDefinitionReaders for loading bean definitions into the supplied context.

Parameters
context the context for which the BeanDefinitionReader should be created
Returns
  • a BeanDefinitionReader for the supplied context

protected void customizeBeanFactory (DefaultListableBeanFactory beanFactory)

Customize the internal bean factory of the ApplicationContext created by this ContextLoader.

The default implementation is empty but can be overridden in subclasses to customize DefaultListableBeanFactory's standard settings.

Parameters
beanFactory the bean factory created by this ContextLoader

protected void customizeContext (GenericApplicationContext context)

Customize the GenericApplicationContext created by this ContextLoader after bean definitions have been loaded into the context but before the context is refreshed.

The default implementation is empty but can be overridden in subclasses to customize the application context.

Parameters
context the newly created application context

protected void prepareContext (GenericApplicationContext context)

Prepare the GenericApplicationContext created by this ContextLoader. Called before bean definitions are read.

The default implementation is empty. Can be overridden in subclasses to customize GenericApplicationContext's standard settings.

Parameters
context the context for which the BeanDefinitionReader should be created