Clarify supported targets for annotations in the TestContext framework
Closes gh-32772
This commit is contained in:
parent
3048cfe9d9
commit
ac0136b75c
|
@ -165,8 +165,8 @@ for further details.
|
||||||
[[integration-testing-annotations-testconstructor]]
|
[[integration-testing-annotations-testconstructor]]
|
||||||
== `@TestConstructor`
|
== `@TestConstructor`
|
||||||
|
|
||||||
`@TestConstructor` is a type-level annotation that is used to configure how the parameters
|
`@TestConstructor` is an annotation that can be applied to a test class to configure how
|
||||||
of a test class constructor are autowired from components in the test's
|
the parameters of a test class constructor are autowired from components in the test's
|
||||||
`ApplicationContext`.
|
`ApplicationContext`.
|
||||||
|
|
||||||
If `@TestConstructor` is not present or meta-present on a test class, the default _test
|
If `@TestConstructor` is not present or meta-present on a test class, the default _test
|
||||||
|
@ -199,9 +199,9 @@ Spring Boot Test.
|
||||||
[[integration-testing-annotations-nestedtestconfiguration]]
|
[[integration-testing-annotations-nestedtestconfiguration]]
|
||||||
== `@NestedTestConfiguration`
|
== `@NestedTestConfiguration`
|
||||||
|
|
||||||
`@NestedTestConfiguration` is a type-level annotation that is used to configure how
|
`@NestedTestConfiguration` is an annotation that can be applied to a test class to
|
||||||
Spring test configuration annotations are processed within enclosing class hierarchies
|
configure how Spring test configuration annotations are processed within enclosing class
|
||||||
for inner test classes.
|
hierarchies for inner test classes.
|
||||||
|
|
||||||
If `@NestedTestConfiguration` is not present or meta-present on a test class, in its
|
If `@NestedTestConfiguration` is not present or meta-present on a test class, in its
|
||||||
supertype hierarchy, or in its enclosing class hierarchy, the default _enclosing
|
supertype hierarchy, or in its enclosing class hierarchy, the default _enclosing
|
||||||
|
|
|
@ -13,10 +13,10 @@ xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-runne
|
||||||
[[integration-testing-annotations-junit4-ifprofilevalue]]
|
[[integration-testing-annotations-junit4-ifprofilevalue]]
|
||||||
== `@IfProfileValue`
|
== `@IfProfileValue`
|
||||||
|
|
||||||
`@IfProfileValue` indicates that the annotated test is enabled for a specific testing
|
`@IfProfileValue` indicates that the annotated test class or test method is enabled for a
|
||||||
environment. If the configured `ProfileValueSource` returns a matching `value` for the
|
specific testing environment. If the configured `ProfileValueSource` returns a matching
|
||||||
provided `name`, the test is enabled. Otherwise, the test is disabled and, effectively,
|
`value` for the provided `name`, the test is enabled. Otherwise, the test is disabled
|
||||||
ignored.
|
and, effectively, ignored.
|
||||||
|
|
||||||
You can apply `@IfProfileValue` at the class level, the method level, or both.
|
You can apply `@IfProfileValue` at the class level, the method level, or both.
|
||||||
Class-level usage of `@IfProfileValue` takes precedence over method-level usage for any
|
Class-level usage of `@IfProfileValue` takes precedence over method-level usage for any
|
||||||
|
@ -90,11 +90,12 @@ Kotlin::
|
||||||
[[integration-testing-annotations-junit4-profilevaluesourceconfiguration]]
|
[[integration-testing-annotations-junit4-profilevaluesourceconfiguration]]
|
||||||
== `@ProfileValueSourceConfiguration`
|
== `@ProfileValueSourceConfiguration`
|
||||||
|
|
||||||
`@ProfileValueSourceConfiguration` is a class-level annotation that specifies what type
|
`@ProfileValueSourceConfiguration` is an annotation that can be applied to a test class
|
||||||
of `ProfileValueSource` to use when retrieving profile values configured through the
|
to specify what type of `ProfileValueSource` to use when retrieving profile values
|
||||||
`@IfProfileValue` annotation. If `@ProfileValueSourceConfiguration` is not declared for a
|
configured through the `@IfProfileValue` annotation. If
|
||||||
test, `SystemProfileValueSource` is used by default. The following example shows how to
|
`@ProfileValueSourceConfiguration` is not declared for a test, `SystemProfileValueSource`
|
||||||
use `@ProfileValueSourceConfiguration`:
|
is used by default. The following example shows how to use
|
||||||
|
`@ProfileValueSourceConfiguration`:
|
||||||
|
|
||||||
[tabs]
|
[tabs]
|
||||||
======
|
======
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[[spring-testing-annotation-activeprofiles]]
|
[[spring-testing-annotation-activeprofiles]]
|
||||||
= `@ActiveProfiles`
|
= `@ActiveProfiles`
|
||||||
|
|
||||||
`@ActiveProfiles` is a class-level annotation that is used to declare which bean
|
`@ActiveProfiles` is an annotation that can be applied to a test class to declare which
|
||||||
definition profiles should be active when loading an `ApplicationContext` for an
|
bean definition profiles should be active when loading an `ApplicationContext` for an
|
||||||
integration test.
|
integration test.
|
||||||
|
|
||||||
The following example indicates that the `dev` profile should be active:
|
The following example indicates that the `dev` profile should be active:
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
= `@BootstrapWith`
|
= `@BootstrapWith`
|
||||||
:page-section-summary-toc: 1
|
:page-section-summary-toc: 1
|
||||||
|
|
||||||
`@BootstrapWith` is a class-level annotation that you can use to configure how the Spring
|
`@BootstrapWith` is an annotation that can be applied to a test class to configure how
|
||||||
TestContext Framework is bootstrapped. Specifically, you can use `@BootstrapWith` to
|
the Spring TestContext Framework is bootstrapped. Specifically, you can use
|
||||||
specify a custom `TestContextBootstrapper`. See the section on
|
`@BootstrapWith` to specify a custom `TestContextBootstrapper`. See the section on
|
||||||
xref:testing/testcontext-framework/bootstrapping.adoc[bootstrapping the TestContext framework] for further details.
|
xref:testing/testcontext-framework/bootstrapping.adoc[bootstrapping the TestContext framework] for further details.
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[[spring-testing-annotation-contextconfiguration]]
|
[[spring-testing-annotation-contextconfiguration]]
|
||||||
= `@ContextConfiguration`
|
= `@ContextConfiguration`
|
||||||
|
|
||||||
`@ContextConfiguration` defines class-level metadata that is used to determine how to
|
`@ContextConfiguration` is an annotation that can be applied to a test class to configure
|
||||||
load and configure an `ApplicationContext` for integration tests. Specifically,
|
metadata that is used to determine how to load and configure an `ApplicationContext` for
|
||||||
`@ContextConfiguration` declares the application context resource `locations` or the
|
integration tests. Specifically, `@ContextConfiguration` declares the application context
|
||||||
component `classes` used to load the context.
|
resource `locations` or the component `classes` used to load the context.
|
||||||
|
|
||||||
Resource locations are typically XML configuration files or Groovy scripts located in the
|
Resource locations are typically XML configuration files or Groovy scripts located in the
|
||||||
classpath, while component classes are typically `@Configuration` classes. However,
|
classpath, while component classes are typically `@Configuration` classes. However,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[[spring-testing-annotation-contextcustomizerfactories]]
|
[[spring-testing-annotation-contextcustomizerfactories]]
|
||||||
= `@ContextCustomizerFactories`
|
= `@ContextCustomizerFactories`
|
||||||
|
|
||||||
`@ContextCustomizerFactories` is used to register `ContextCustomizerFactory`
|
`@ContextCustomizerFactories` is an annotation that can be applied to a test class to
|
||||||
implementations for a particular test class, its subclasses, and its nested classes. If
|
register `ContextCustomizerFactory` implementations for the particular test class, its
|
||||||
you wish to register a factory globally, you should register it via the automatic
|
subclasses, and its nested classes. If you wish to register a factory globally, you
|
||||||
discovery mechanism described in
|
should register it via the automatic discovery mechanism described in
|
||||||
xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[`ContextCustomizerFactory` Configuration].
|
xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[`ContextCustomizerFactory` Configuration].
|
||||||
|
|
||||||
The following example shows how to register two `ContextCustomizerFactory` implementations:
|
The following example shows how to register two `ContextCustomizerFactory` implementations:
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
[[spring-testing-annotation-contexthierarchy]]
|
[[spring-testing-annotation-contexthierarchy]]
|
||||||
= `@ContextHierarchy`
|
= `@ContextHierarchy`
|
||||||
|
|
||||||
`@ContextHierarchy` is a class-level annotation that is used to define a hierarchy of
|
`@ContextHierarchy` is an annotation that can be applied to a test class to define a
|
||||||
`ApplicationContext` instances for integration tests. `@ContextHierarchy` should be
|
hierarchy of `ApplicationContext` instances for integration tests. `@ContextHierarchy`
|
||||||
declared with a list of one or more `@ContextConfiguration` instances, each of which
|
should be declared with a list of one or more `@ContextConfiguration` instances, each of
|
||||||
defines a level in the context hierarchy. The following examples demonstrate the use of
|
which defines a level in the context hierarchy. The following examples demonstrate the
|
||||||
`@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be used
|
use of `@ContextHierarchy` within a single test class (`@ContextHierarchy` can also be
|
||||||
within a test class hierarchy):
|
used within a test class hierarchy):
|
||||||
|
|
||||||
[tabs]
|
[tabs]
|
||||||
======
|
======
|
||||||
|
|
|
@ -10,9 +10,9 @@ rebuilt for any subsequent test that requires a context with the same configurat
|
||||||
metadata.
|
metadata.
|
||||||
|
|
||||||
You can use `@DirtiesContext` as both a class-level and a method-level annotation within
|
You can use `@DirtiesContext` as both a class-level and a method-level annotation within
|
||||||
the same class or class hierarchy. In such scenarios, the `ApplicationContext` is marked
|
the same test class or test class hierarchy. In such scenarios, the `ApplicationContext`
|
||||||
as dirty before or after any such annotated method as well as before or after the current
|
is marked as dirty before or after any such annotated method as well as before or after
|
||||||
test class, depending on the configured `methodMode` and `classMode`. When
|
the current test class, depending on the configured `methodMode` and `classMode`. When
|
||||||
`@DirtiesContext` is declared at both the class level and the method level, the
|
`@DirtiesContext` is declared at both the class level and the method level, the
|
||||||
configured modes from both annotations will be honored. For example, if the class mode is
|
configured modes from both annotations will be honored. For example, if the class mode is
|
||||||
set to `BEFORE_EACH_TEST_METHOD` and the method mode is set to `AFTER_METHOD`, the
|
set to `BEFORE_EACH_TEST_METHOD` and the method mode is set to `AFTER_METHOD`, the
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[spring-testing-annotation-disabledinaotmode]]
|
[[spring-testing-annotation-disabledinaotmode]]
|
||||||
= `@DisabledInAotMode`
|
= `@DisabledInAotMode`
|
||||||
|
|
||||||
`@DisabledInAotMode` signals that an annotated test class is disabled in Spring AOT
|
`@DisabledInAotMode` signals that the annotated test class is disabled in Spring AOT
|
||||||
(ahead-of-time) mode, which means that the `ApplicationContext` for the test class will
|
(ahead-of-time) mode, which means that the `ApplicationContext` for the test class will
|
||||||
not be processed for AOT optimizations at build time.
|
not be processed for AOT optimizations at build time.
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
[[spring-testing-annotation-dynamicpropertysource]]
|
[[spring-testing-annotation-dynamicpropertysource]]
|
||||||
= `@DynamicPropertySource`
|
= `@DynamicPropertySource`
|
||||||
|
|
||||||
`@DynamicPropertySource` is a method-level annotation that you can use to register
|
`@DynamicPropertySource` is an annotation that can be applied to methods in integration
|
||||||
_dynamic_ properties to be added to the set of `PropertySources` in the `Environment` for
|
test classes that need to register _dynamic_ properties to be added to the set of
|
||||||
an `ApplicationContext` loaded for an integration test. Dynamic properties are useful
|
`PropertySources` in the `Environment` for an `ApplicationContext` loaded for an
|
||||||
when you do not know the value of the properties upfront – for example, if the properties
|
integration test. Dynamic properties are useful when you do not know the value of the
|
||||||
are managed by an external resource such as for a container managed by the
|
properties upfront – for example, if the properties are managed by an external resource
|
||||||
{testcontainers-site}[Testcontainers] project.
|
such as for a container managed by the {testcontainers-site}[Testcontainers] project.
|
||||||
|
|
||||||
The following example demonstrates how to register a dynamic property:
|
The following example demonstrates how to register a dynamic property:
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
= `@RecordApplicationEvents`
|
= `@RecordApplicationEvents`
|
||||||
:page-section-summary-toc: 1
|
:page-section-summary-toc: 1
|
||||||
|
|
||||||
`@RecordApplicationEvents` is a class-level annotation that is used to instruct the
|
`@RecordApplicationEvents` is an annotation that can be applied to a test class to
|
||||||
_Spring TestContext Framework_ to record all application events that are published in the
|
instruct the _Spring TestContext Framework_ to record all application events that are
|
||||||
`ApplicationContext` during the execution of a single test.
|
published in the `ApplicationContext` during the execution of a single test.
|
||||||
|
|
||||||
The recorded events can be accessed via the `ApplicationEvents` API within tests.
|
The recorded events can be accessed via the `ApplicationEvents` API within tests.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[spring-testing-annotation-testexecutionlisteners]]
|
[[spring-testing-annotation-testexecutionlisteners]]
|
||||||
= `@TestExecutionListeners`
|
= `@TestExecutionListeners`
|
||||||
|
|
||||||
`@TestExecutionListeners` is used to register listeners for a particular test class, its
|
`@TestExecutionListeners` is used to register listeners for the annotated test class, its
|
||||||
subclasses, and its nested classes. If you wish to register a listener globally, you
|
subclasses, and its nested classes. If you wish to register a listener globally, you
|
||||||
should register it via the automatic discovery mechanism described in
|
should register it via the automatic discovery mechanism described in
|
||||||
xref:testing/testcontext-framework/tel-config.adoc[`TestExecutionListener` Configuration].
|
xref:testing/testcontext-framework/tel-config.adoc[`TestExecutionListener` Configuration].
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[[spring-testing-annotation-testpropertysource]]
|
[[spring-testing-annotation-testpropertysource]]
|
||||||
= `@TestPropertySource`
|
= `@TestPropertySource`
|
||||||
|
|
||||||
`@TestPropertySource` is a class-level annotation that you can use to configure the
|
`@TestPropertySource` is an annotation that can be applied to a test class to configure
|
||||||
locations of properties files and inlined properties to be added to the set of
|
the locations of properties files and inlined properties to be added to the set of
|
||||||
`PropertySources` in the `Environment` for an `ApplicationContext` loaded for an
|
`PropertySources` in the `Environment` for an `ApplicationContext` loaded for an
|
||||||
integration test.
|
integration test.
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[[spring-testing-annotation-webappconfiguration]]
|
[[spring-testing-annotation-webappconfiguration]]
|
||||||
= `@WebAppConfiguration`
|
= `@WebAppConfiguration`
|
||||||
|
|
||||||
`@WebAppConfiguration` is a class-level annotation that you can use to declare that the
|
`@WebAppConfiguration` is an annotation that can be applied to a test class to declare
|
||||||
`ApplicationContext` loaded for an integration test should be a `WebApplicationContext`.
|
that the `ApplicationContext` loaded for an integration test should be a
|
||||||
The mere presence of `@WebAppConfiguration` on a test class ensures that a
|
`WebApplicationContext`. The mere presence of `@WebAppConfiguration` on a test class
|
||||||
`WebApplicationContext` is loaded for the test, using the default value of
|
ensures that a `WebApplicationContext` is loaded for the test, using the default value of
|
||||||
`"file:src/main/webapp"` for the path to the root of the web application (that is, the
|
`"file:src/main/webapp"` for the path to the root of the web application (that is, the
|
||||||
resource base path). The resource base path is used behind the scenes to create a
|
resource base path). The resource base path is used behind the scenes to create a
|
||||||
`MockServletContext`, which serves as the `ServletContext` for the test's
|
`MockServletContext`, which serves as the `ServletContext` for the test's
|
||||||
|
|
|
@ -35,8 +35,8 @@ import java.lang.annotation.Target;
|
||||||
* will be supplied a new context.
|
* will be supplied a new context.
|
||||||
*
|
*
|
||||||
* <p>{@code @DirtiesContext} may be used as a class-level and method-level
|
* <p>{@code @DirtiesContext} may be used as a class-level and method-level
|
||||||
* annotation within the same class or class hierarchy. In such scenarios, the
|
* annotation within the same test class or test class hierarchy. In such scenarios,
|
||||||
* {@code ApplicationContext} will be marked as <em>dirty</em> before or
|
* the {@code ApplicationContext} will be marked as <em>dirty</em> before or
|
||||||
* after any such annotated method as well as before or after the current test
|
* after any such annotated method as well as before or after the current test
|
||||||
* class, depending on the configured {@link #methodMode} and {@link #classMode}.
|
* class, depending on the configured {@link #methodMode} and {@link #classMode}.
|
||||||
* When {@code @DirtiesContext} is declared at both the class level and the
|
* When {@code @DirtiesContext} is declared at both the class level and the
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test annotation for use with JUnit 4 to indicate whether a test is enabled or
|
* Test annotation for use with JUnit 4 to indicate whether the annotated test
|
||||||
* disabled for a specific testing profile.
|
* class or test method is enabled or disabled for a specific testing profile.
|
||||||
*
|
*
|
||||||
* <p>In the context of this annotation, the term <em>profile</em> refers to
|
* <p>In the context of this annotation, the term <em>profile</em> refers to
|
||||||
* a Java system property by default; however, the semantics can be changed
|
* a Java system property by default; however, the semantics can be changed
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code ProfileValueSourceConfiguration} is a class-level annotation for use
|
* {@code ProfileValueSourceConfiguration} is an annotation that can be applied
|
||||||
* with JUnit 4 which is used to specify what type of {@link ProfileValueSource}
|
* to a JUnit 4 based test class to specify what type of {@link ProfileValueSource}
|
||||||
* to use when retrieving <em>profile values</em> configured via
|
* to use when retrieving <em>profile values</em> configured via
|
||||||
* {@link IfProfileValue @IfProfileValue}.
|
* {@link IfProfileValue @IfProfileValue}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,10 +26,10 @@ import java.lang.annotation.Target;
|
||||||
import org.springframework.core.annotation.AliasFor;
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code ActiveProfiles} is a class-level annotation that is used to declare
|
* {@code ActiveProfiles} is an annotation that can be applied to a test class
|
||||||
* which <em>active bean definition profiles</em> should be used when loading
|
* to declare which <em>active bean definition profiles</em> should be used when
|
||||||
* an {@link org.springframework.context.ApplicationContext ApplicationContext}
|
* loading an {@link org.springframework.context.ApplicationContext ApplicationContext}
|
||||||
* for test classes.
|
* for integration tests.
|
||||||
*
|
*
|
||||||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||||
* <em>composed annotations</em>.
|
* <em>composed annotations</em>.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @BootstrapWith} defines class-level metadata that is used to determine
|
* {@code @BootstrapWith} is an annotation that can be applied to a test class
|
||||||
* how to bootstrap the <em>Spring TestContext Framework</em>.
|
* to define metadata that is used to determine how to bootstrap the
|
||||||
|
* <em>Spring TestContext Framework</em>.
|
||||||
*
|
*
|
||||||
* <p>This annotation may also be used as a <em>meta-annotation</em> to create
|
* <p>This annotation may also be used as a <em>meta-annotation</em> to create
|
||||||
* custom <em>composed annotations</em>. As of Spring Framework 5.1, a locally
|
* custom <em>composed annotations</em>. As of Spring Framework 5.1, a locally
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -28,9 +28,10 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.core.annotation.AliasFor;
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @ContextConfiguration} defines class-level metadata that is used to determine
|
* {@code @ContextConfiguration} is an annotation that can be applied to a test
|
||||||
* how to load and configure an {@link org.springframework.context.ApplicationContext
|
* class to define metadata that is used to determine how to load and configure
|
||||||
* ApplicationContext} for integration tests.
|
* an {@link org.springframework.context.ApplicationContext ApplicationContext}
|
||||||
|
* for integration tests.
|
||||||
*
|
*
|
||||||
* <h3>Supported Resource Types</h3>
|
* <h3>Supported Resource Types</h3>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,9 +26,9 @@ import java.lang.annotation.Target;
|
||||||
import org.springframework.core.annotation.AliasFor;
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @ContextCustomizerFactories} defines class-level metadata for configuring
|
* {@code @ContextCustomizerFactories} is an annotation that can be applied to a
|
||||||
* which {@link ContextCustomizerFactory} implementations should be registered with
|
* test class to configure which {@link ContextCustomizerFactory} implementations
|
||||||
* the <em>Spring TestContext Framework</em>.
|
* should be registered with the <em>Spring TestContext Framework</em>.
|
||||||
*
|
*
|
||||||
* <p>{@code @ContextCustomizerFactories} is used to register factories for a
|
* <p>{@code @ContextCustomizerFactories} is used to register factories for a
|
||||||
* particular test class, its subclasses, and its nested classes. If you wish to
|
* particular test class, its subclasses, and its nested classes. If you wish to
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @ContextHierarchy} is a class-level annotation that is used to define
|
* {@code @ContextHierarchy} is an annotation that can be applied to a test class
|
||||||
* a hierarchy of {@link org.springframework.context.ApplicationContext
|
* to define a hierarchy of {@link org.springframework.context.ApplicationContext
|
||||||
* ApplicationContexts} for integration tests.
|
* ApplicationContexts} for integration tests.
|
||||||
*
|
*
|
||||||
* <h3>Examples</h3>
|
* <h3>Examples</h3>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,8 +23,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method-level annotation for integration tests that need to add properties with
|
* {@code @DynamicPropertySource} is an annotation that can be applied to methods
|
||||||
* dynamic values to the {@code Environment}'s set of {@code PropertySources}.
|
* in integration test classes that need to add properties with dynamic values to
|
||||||
|
* the {@code Environment}'s set of {@code PropertySources}.
|
||||||
*
|
*
|
||||||
* <p>This annotation and its supporting infrastructure were originally designed
|
* <p>This annotation and its supporting infrastructure were originally designed
|
||||||
* to allow properties from
|
* to allow properties from
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -29,9 +29,9 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @NestedTestConfiguration} is a type-level annotation that is used to
|
* {@code @NestedTestConfiguration} is an annotation that can be applied to a test
|
||||||
* configure how Spring test configuration annotations are processed within
|
* class to configure how Spring test configuration annotations are processed
|
||||||
* enclosing class hierarchies (i.e., for <em>inner</em> test classes).
|
* within enclosing class hierarchies (i.e., for <em>inner</em> test classes).
|
||||||
*
|
*
|
||||||
* <p>If {@code @NestedTestConfiguration} is not <em>present</em> or
|
* <p>If {@code @NestedTestConfiguration} is not <em>present</em> or
|
||||||
* <em>meta-present</em> on a test class, in its supertype hierarchy, or in its
|
* <em>meta-present</em> on a test class, in its supertype hierarchy, or in its
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -29,9 +29,9 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @TestConstructor} is a type-level annotation that is used to configure
|
* {@code @TestConstructor} is an annotation that can be applied to a test class
|
||||||
* how the parameters of a test class constructor are autowired from components
|
* to configure how the parameters of a test class constructor are autowired from
|
||||||
* in the test's {@link org.springframework.context.ApplicationContext
|
* components in the test's {@link org.springframework.context.ApplicationContext
|
||||||
* ApplicationContext}.
|
* ApplicationContext}.
|
||||||
*
|
*
|
||||||
* <p>If {@code @TestConstructor} is not <em>present</em> or <em>meta-present</em>
|
* <p>If {@code @TestConstructor} is not <em>present</em> or <em>meta-present</em>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,9 +26,9 @@ import java.lang.annotation.Target;
|
||||||
import org.springframework.core.annotation.AliasFor;
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code TestExecutionListeners} defines class-level metadata for configuring
|
* {@code @TestExecutionListeners} is an annotation that can be applied to a test
|
||||||
* which {@link TestExecutionListener TestExecutionListeners} should be
|
* class to configure which {@link TestExecutionListener TestExecutionListeners}
|
||||||
* registered with a {@link TestContextManager}.
|
* should be registered with a {@link TestContextManager}.
|
||||||
*
|
*
|
||||||
* <p>{@code @TestExecutionListeners} is used to register listeners for a
|
* <p>{@code @TestExecutionListeners} is used to register listeners for a
|
||||||
* particular test class, its subclasses, and its nested classes. If you wish to
|
* particular test class, its subclasses, and its nested classes. If you wish to
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -28,8 +28,8 @@ import org.springframework.core.annotation.AliasFor;
|
||||||
import org.springframework.core.io.support.PropertySourceFactory;
|
import org.springframework.core.io.support.PropertySourceFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @TestPropertySource} is a class-level annotation that is used to
|
* {@code @TestPropertySource} is an annotation that can be applied to a test
|
||||||
* configure the {@link #locations} of properties files and inlined
|
* class to configure the {@link #locations} of properties files and inlined
|
||||||
* {@link #properties} to be added to the {@code Environment}'s set of
|
* {@link #properties} to be added to the {@code Environment}'s set of
|
||||||
* {@code PropertySources} for an
|
* {@code PropertySources} for an
|
||||||
* {@link org.springframework.context.ApplicationContext ApplicationContext}
|
* {@link org.springframework.context.ApplicationContext ApplicationContext}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -25,7 +25,7 @@ import java.lang.annotation.Target;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @DisabledInAotMode} signals that an annotated test class is <em>disabled</em>
|
* {@code @DisabledInAotMode} signals that the annotated test class is <em>disabled</em>
|
||||||
* in Spring AOT (ahead-of-time) mode, which means that the {@code ApplicationContext}
|
* in Spring AOT (ahead-of-time) mode, which means that the {@code ApplicationContext}
|
||||||
* for the test class will not be processed for AOT optimizations at build time.
|
* for the test class will not be processed for AOT optimizations at build time.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,8 +24,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @RecordApplicationEvents} is a class-level annotation that is used to
|
* {@code @RecordApplicationEvents} is an annotation that can be applied to a test
|
||||||
* instruct the <em>Spring TestContext Framework</em> to record all
|
* class to instruct the <em>Spring TestContext Framework</em> to record all
|
||||||
* {@linkplain org.springframework.context.ApplicationEvent application events}
|
* {@linkplain org.springframework.context.ApplicationEvent application events}
|
||||||
* that are published in the {@link org.springframework.context.ApplicationContext
|
* that are published in the {@link org.springframework.context.ApplicationContext
|
||||||
* ApplicationContext} during the execution of a single test, either from the
|
* ApplicationContext} during the execution of a single test, either from the
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,9 +24,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @WebAppConfiguration} is a class-level annotation that is used to
|
* {@code @WebAppConfiguration} is an annotation that can be applied to a test
|
||||||
* declare that the {@code ApplicationContext} loaded for an integration test
|
* class to declare that the {@code ApplicationContext} loaded for an integration
|
||||||
* should be a {@link org.springframework.web.context.WebApplicationContext
|
* test should be a {@link org.springframework.web.context.WebApplicationContext
|
||||||
* WebApplicationContext}.
|
* WebApplicationContext}.
|
||||||
*
|
*
|
||||||
* <p>The presence of {@code @WebAppConfiguration} on a test class indicates that
|
* <p>The presence of {@code @WebAppConfiguration} on a test class indicates that
|
||||||
|
|
Loading…
Reference in New Issue