public static enum SpringBootTest.WebEnvironment extends Enum<SpringBootTest.WebEnvironment>
Enum Constant and Description |
---|
DEFINED_PORT
Creates a (reactive) web application context without defining any
server.port=0 Environment property. |
MOCK
Creates a
WebApplicationContext with a mock servlet environment if
servlet APIs are on the classpath, a ReactiveWebApplicationContext if
Spring WebFlux is on the classpath or a regular ApplicationContext
otherwise. |
NONE
Creates an
ApplicationContext and sets
SpringApplication.setWebApplicationType(WebApplicationType) to
WebApplicationType.NONE . |
RANDOM_PORT
Creates a web application context (reactive or servlet based) and sets a
server.port=0 Environment property (which usually triggers
listening on a random port). |
Modifier and Type | Method and Description |
---|---|
boolean |
isEmbedded()
Return if the environment uses an
ServletWebServerApplicationContext . |
static SpringBootTest.WebEnvironment |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpringBootTest.WebEnvironment[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpringBootTest.WebEnvironment MOCK
WebApplicationContext
with a mock servlet environment if
servlet APIs are on the classpath, a ReactiveWebApplicationContext
if
Spring WebFlux is on the classpath or a regular ApplicationContext
otherwise.public static final SpringBootTest.WebEnvironment RANDOM_PORT
server.port=0
Environment
property (which usually triggers
listening on a random port). Often used in conjunction with a
@LocalServerPort
injected field on the test.public static final SpringBootTest.WebEnvironment DEFINED_PORT
server.port=0
Environment
property.public static final SpringBootTest.WebEnvironment NONE
ApplicationContext
and sets
SpringApplication.setWebApplicationType(WebApplicationType)
to
WebApplicationType.NONE
.public static SpringBootTest.WebEnvironment[] values()
for (SpringBootTest.WebEnvironment c : SpringBootTest.WebEnvironment.values()) System.out.println(c);
public static SpringBootTest.WebEnvironment valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isEmbedded()
ServletWebServerApplicationContext
.ServletWebServerApplicationContext
is used.