Closed
Description
Sam Brannen opened SPR-14649 and commented
Status Quo
The recently added support for @EnabledIf
and @DisabledIf
allows for conditional test execution in JUnit Jupiter via SpEL expressions and property look-ups in the Spring Environment
.
This functionality is extremely powerful; however, there is also a very large drawback with the current implementation. Namely, the test's ApplicationContext
is always eagerly loaded, even if the ApplicationContext
will never be used by a test.
Deliverables
- Introduce a
boolean
flag in@EnabledIf
and@DisabledIf
to control whether the test'sApplicationContext
should be eagerly loaded.- set the default for the flag to
false
so that users have to explicitly think about the consequences.
- set the default for the flag to
- Introduce code for evaluating the following when the test's
ApplicationContext
is not available:- property placeholders for system properties and environment variables
- SpEL expressions that do not access beans from the
ApplicationContext
Affects: 5.0 M2
Issue Links:
- Introduce support for disabling JUnit Jupiter tests with SpEL expressions [SPR-14614] #19181 Introduce support for disabling JUnit Jupiter tests with SpEL expressions ("depends on")
- Introduce support for enabling JUnit Jupiter tests with SpEL expressions [SPR-14644] #19210 Introduce support for enabling JUnit Jupiter tests with SpEL expressions ("depends on")
Referenced from: commits 5c9350b