@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @BootstrapWith(value=SpringBootTestContextBootstrapper.class) public @interface SpringBootTest
SpringBootContextLoader
as the default ContextLoader
when no
specific @ContextConfiguration(loader=...)
is
defined.@SpringBootConfiguration
when nested
@Configuration
is not used, and no explicit classes
are
specified.Environment
properties to be defined using the
properties attribute
.webEnvironment
modes,
including the ability to start a fully running container listening on a
defined
or random
port.TestRestTemplate
bean for use in web tests that are using a fully running container.
ContextConfiguration
Modifier and Type | Optional Element and Description |
---|---|
Class<?>[] |
classes
The annotated classes to use for loading an
ApplicationContext . |
String[] |
properties
Properties in form key=value that should be added to the Spring
Environment before the test runs. |
String[] |
value
Alias for
properties() . |
SpringBootTest.WebEnvironment |
webEnvironment
The type of web environment to create when applicable.
|
@AliasFor(value="properties") public abstract String[] value
properties()
.@AliasFor(value="value") public abstract String[] properties
Environment
before the test runs.public abstract Class<?>[] classes
ApplicationContext
. Can also
be specified using
@ContextConfiguration(classes=...)
. If no
explicit classes are defined the test will look for nested
@Configuration
classes, before falling back to a
SpringBootConfiguration
search.ContextConfiguration.classes()
public abstract SpringBootTest.WebEnvironment webEnvironment
SpringBootTest.WebEnvironment.MOCK
.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.