WebEnvironment

An enumeration web environment modes.

Entries

Link copied to clipboard

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.

Link copied to clipboard

Creates a web application context (reactive or servlet based) and sets a server.port=0Environment property (which usually triggers listening on a random port). Often used in conjunction with a @LocalServerPort injected field on the test.

Link copied to clipboard

Creates a (reactive) web application context without defining any server.port=0Environment property.

Link copied to clipboard

Functions

Link copied to clipboard
open fun isEmbedded(): Boolean
Return if the environment uses an ServletWebServerApplicationContext.
Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.