Browse Source

Emphasize @⁠Configuration classes over XML and Groovy in testing chapter

Closes gh-36393
pull/28225/merge
Sam Brannen 3 weeks ago
parent
commit
706c98228d
  1. 2
      framework-docs/modules/ROOT/nav.adoc
  2. 17
      framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management.adoc

2
framework-docs/modules/ROOT/nav.adoc

@ -330,9 +330,9 @@
*** xref:testing/testcontext-framework/application-events.adoc[] *** xref:testing/testcontext-framework/application-events.adoc[]
*** xref:testing/testcontext-framework/test-execution-events.adoc[] *** xref:testing/testcontext-framework/test-execution-events.adoc[]
*** xref:testing/testcontext-framework/ctx-management.adoc[] *** xref:testing/testcontext-framework/ctx-management.adoc[]
**** xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[]
**** xref:testing/testcontext-framework/ctx-management/xml.adoc[] **** xref:testing/testcontext-framework/ctx-management/xml.adoc[]
**** xref:testing/testcontext-framework/ctx-management/groovy.adoc[] **** xref:testing/testcontext-framework/ctx-management/groovy.adoc[]
**** xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[]
**** xref:testing/testcontext-framework/ctx-management/mixed-config.adoc[] **** xref:testing/testcontext-framework/ctx-management/mixed-config.adoc[]
**** xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[] **** xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[]
**** xref:testing/testcontext-framework/ctx-management/initializers.adoc[] **** xref:testing/testcontext-framework/ctx-management/initializers.adoc[]

17
framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management.adoc

@ -49,7 +49,6 @@ Kotlin::
<1> Injecting the `ApplicationContext`. <1> Injecting the `ApplicationContext`.
====== ======
Similarly, if your test is configured to load a `WebApplicationContext`, you can inject Similarly, if your test is configured to load a `WebApplicationContext`, you can inject
the web application context into your test, as follows: the web application context into your test, as follows:
@ -87,7 +86,6 @@ Kotlin::
<2> Injecting the `WebApplicationContext`. <2> Injecting the `WebApplicationContext`.
====== ======
Dependency injection by using `@Autowired` is provided by the Dependency injection by using `@Autowired` is provided by the
`DependencyInjectionTestExecutionListener`, which is configured by default `DependencyInjectionTestExecutionListener`, which is configured by default
(see xref:testing/testcontext-framework/fixture-di.adoc[Dependency Injection of Test Fixtures]). (see xref:testing/testcontext-framework/fixture-di.adoc[Dependency Injection of Test Fixtures]).
@ -100,17 +98,18 @@ class level. If your test class does not explicitly declare application context
locations or component classes, the configured `ContextLoader` determines how to load a locations or component classes, the configured `ContextLoader` determines how to load a
context from a default location or default configuration classes. In addition to context context from a default location or default configuration classes. In addition to context
resource locations and component classes, an application context can also be configured resource locations and component classes, an application context can also be configured
through application context initializers. through xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[context customizers]
or xref:testing/testcontext-framework/ctx-management/initializers.adoc[context initializers].
The following sections explain how to use Spring's `@ContextConfiguration` annotation to The following sections explain how to use `@ContextConfiguration` and related annotations
configure a test `ApplicationContext` by using XML configuration files, Groovy scripts, to configure a test `ApplicationContext` by using component classes (typically
component classes (typically `@Configuration` classes), or context initializers. `@Configuration` classes), XML configuration files, Groovy scripts, context customizers,
Alternatively, you can implement and configure your own custom `SmartContextLoader` for or context initializers. Alternatively, you can implement and configure your own custom
advanced use cases. `SmartContextLoader` for advanced use cases.
* xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[Context Configuration with Component Classes]
* xref:testing/testcontext-framework/ctx-management/xml.adoc[Context Configuration with XML resources] * xref:testing/testcontext-framework/ctx-management/xml.adoc[Context Configuration with XML resources]
* xref:testing/testcontext-framework/ctx-management/groovy.adoc[Context Configuration with Groovy Scripts] * xref:testing/testcontext-framework/ctx-management/groovy.adoc[Context Configuration with Groovy Scripts]
* xref:testing/testcontext-framework/ctx-management/javaconfig.adoc[Context Configuration with Component Classes]
* xref:testing/testcontext-framework/ctx-management/mixed-config.adoc[Mixing XML, Groovy Scripts, and Component Classes] * xref:testing/testcontext-framework/ctx-management/mixed-config.adoc[Mixing XML, Groovy Scripts, and Component Classes]
* xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[Context Configuration with Context Customizers] * xref:testing/testcontext-framework/ctx-management/context-customizers.adoc[Context Configuration with Context Customizers]
* xref:testing/testcontext-framework/ctx-management/initializers.adoc[Context Configuration with Context Initializers] * xref:testing/testcontext-framework/ctx-management/initializers.adoc[Context Configuration with Context Initializers]

Loading…
Cancel
Save