@SpringBootTest
SpringBootContextLoader can also be
considered if absolutely necessary.@Deprecated public class SpringApplicationContextLoader extends AbstractContextLoader
ContextLoader that can be used to test Spring Boot applications (those that
normally startup using SpringApplication). Can be used to test non-web features
(like a repository layer) or start a fully-configured embedded servlet container.
Use @WebIntegrationTest (or @IntegrationTest with
@WebAppConfiguration) to indicate that you want to use a real servlet container
or @WebAppConfiguration alone to use a MockServletContext.
If @ActiveProfiles are provided in the test class they will be used to create
the application context.
SpringBootTest,
IntegrationTest,
WebIntegrationTest| Constructor and Description |
|---|
SpringApplicationContextLoader()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected Class<?>[] |
detectDefaultConfigurationClasses(Class<?> declaringClass)
Deprecated.
Detect the default configuration classes for the supplied test class.
|
protected Map<String,Object> |
getEnvironmentProperties(MergedContextConfiguration config)
Deprecated.
|
protected String |
getResourceSuffix()
Deprecated.
|
protected String[] |
getResourceSuffixes()
Deprecated.
|
protected SpringApplication |
getSpringApplication()
Deprecated.
Builds new
SpringApplication instance. |
ApplicationContext |
loadContext(MergedContextConfiguration config)
Deprecated.
|
ApplicationContext |
loadContext(String... locations)
Deprecated.
|
void |
processContextConfiguration(ContextConfigurationAttributes configAttributes)
Deprecated.
|
customizeContext, generateDefaultLocations, isGenerateDefaultLocations, modifyLocations, prepareContext, processLocationspublic SpringApplicationContextLoader()
public ApplicationContext loadContext(MergedContextConfiguration config) throws Exception
Exceptionprotected SpringApplication getSpringApplication()
SpringApplication instance. You can
override this method to add custom behaviorSpringApplication instanceprotected Map<String,Object> getEnvironmentProperties(MergedContextConfiguration config)
public void processContextConfiguration(ContextConfigurationAttributes configAttributes)
processContextConfiguration in interface SmartContextLoaderprocessContextConfiguration in class AbstractContextLoaderprotected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass)
AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(java.lang.Class<?>) .declaringClass - the test class that declared @ContextConfigurationnullAnnotationConfigContextLoaderUtilspublic ApplicationContext loadContext(String... locations) throws Exception
Exceptionprotected String[] getResourceSuffixes()
getResourceSuffixes in class AbstractContextLoaderprotected String getResourceSuffix()
getResourceSuffix in class AbstractContextLoaderCopyright © 2016 Pivotal Software, Inc.. All rights reserved.