@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @BootstrapWith(value=SpringBootTestContextBootstrapper.class) @ExtendWith(value=org.springframework.test.context.junit.jupiter.SpringExtension.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
.args
attribute
.webEnvironment
modes,
including the ability to start a fully running web server listening on a
defined
or random
port.TestRestTemplate
and/or
WebTestClient
bean
for use in web tests that are using a fully running web server.ContextConfiguration
Modifier and Type | Optional Element and Description |
---|---|
String[] |
args
Application arguments that should be passed to the application under test.
|
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 String[] args
ApplicationArguments
,
SpringApplication.run(String...)
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 © 2019 Pivotal Software, Inc.. All rights reserved.