ActiveProfiles class final

Sets the profiles that are active while the test class's application runs.

Use it to load test-only configuration: with ['test'], the file application-test.properties (or .yml) is read on top of application.properties, and beans marked @Profile(['test']) are created. The list replaces spring.profiles.active of the config files, so name the application's own profiles too if the tests need them.

// The dev beans, plus the settings of application-test.yml.
@SpringBootTest()
@ActiveProfiles(['dev', 'test'])
class CheckoutTest { ... }

Spring (Java):

@SpringBootTest
@ActiveProfiles({"dev", "test"})
class CheckoutTest { ... }

Constructors

ActiveProfiles(List<String> profiles)
Activates profiles for the class's application.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
profiles → List<String>
The profile names, in order; they become spring.profiles.active.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited