Package org.springframework.test.context

# Class ContextLoadException

java.lang.Object
java.lang.Throwable
java.lang.Exception
org.springframework.test.context.ContextLoadException

All Implemented Interfaces:
  `Serializable`

public class ContextLoadException extends Exception
Exception thrown when an error occurs while a `SmartContextLoader` attempts to load an `ApplicationContext`.

This exception provides access to the application context that failed to load as well as the exception caught while attempting to load that context.

Since:
  6.0
Author:
  Sam Brannen
See Also:
  - `SmartContextLoader.loadContext(MergedContextConfiguration)`
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`ContextLoadException(org.springframework.context.ApplicationContext applicationContext, Throwable cause)`
Create a new `ContextLoadException` for the supplied `ApplicationContext` and `Throwable`.

## Method Summary

Modifier and Type
Method
Description
`org.springframework.context.ApplicationContext`
`getApplicationContext()`
Get the `ApplicationContext` that failed to load.

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ContextLoadException

public ContextLoadException(org.springframework.context.ApplicationContext applicationContext, Throwable cause)
Create a new `ContextLoadException` for the supplied `ApplicationContext` and `Throwable`.

Parameters:
  `applicationContext` - the application context that failed to load
  `cause` - the exception caught while attempting to load that context

## Method Details

### getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Get the `ApplicationContext` that failed to load.

Clients must not retain a long-lived reference to the context returned from this method.