Skip to content

Commit e653660

Browse files
committed
[SPR-8401] Added documentation for @activeprofiles in the "Annotations" section.
1 parent d98316e commit e653660

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

spring-framework-reference/src/testing.xml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,50 @@ public class ConfigClassApplicationContextTests {
460460
<note>
461461
<para><interfacename>@ContextConfiguration</interfacename>
462462
provides support for <emphasis>inheriting</emphasis> resource
463-
locations or configuration classes by default.</para>
463+
locations or configuration classes declared by superclasses by
464+
default.</para>
464465
</note>
465466

466467
<para>See <link linkend="testcontext-ctx-management">Context
467468
management and caching</link> and Javadoc for examples and further
468469
details.</para>
469470
</listitem>
470471

472+
<listitem>
473+
<para><emphasis
474+
role="bold"><interfacename>@ActiveProfiles</interfacename></emphasis></para>
475+
476+
<para>A class-level annotation that is used to declare which
477+
<emphasis>bean definition profiles</emphasis> should be active
478+
when loading an <interfacename>ApplicationContext</interfacename>
479+
for test classes.</para>
480+
481+
<programlisting language="java">@ContextConfiguration
482+
<emphasis role="bold">@ActiveProfiles</emphasis>("dev")
483+
public class DeveloperTests {
484+
<lineannotation>// class body...</lineannotation>
485+
}</programlisting>
486+
487+
<programlisting language="java">@ContextConfiguration
488+
<emphasis role="bold">@ActiveProfiles</emphasis>({"dev", "integration"})
489+
public class DeveloperIntegrationTests {
490+
<lineannotation>// class body...</lineannotation>
491+
}</programlisting>
492+
493+
<note>
494+
<para><interfacename>@ActiveProfiles</interfacename> provides
495+
support for <emphasis>inheriting</emphasis> active bean
496+
definition profiles declared by superclasses classes by
497+
default.</para>
498+
</note>
499+
500+
<para>See <link
501+
linkend="testcontext-ctx-management-env-profiles">Context
502+
configuration with environment profiles</link> and the Javadoc for
503+
<interfacename>@ActiveProfiles</interfacename> for examples and
504+
further details.</para>
505+
</listitem>
506+
471507
<listitem>
472508
<para><emphasis
473509
role="bold"><interfacename>@DirtiesContext</interfacename></emphasis></para>
@@ -1052,7 +1088,7 @@ public void testProcessRepeatedly() {
10521088
</listitem>
10531089
</itemizedlist>
10541090

1055-
<para>The following three sections explain how to configure the
1091+
<para>The following sections explain how to configure the
10561092
<classname>TestContext</classname> framework through annotations and
10571093
provide working examples of how to write unit and integration tests
10581094
with the framework.</para>
@@ -1563,6 +1599,8 @@ public class TransferServiceTest {
15631599
we specify all three configuration classes via the
15641600
<interfacename>@ContextConfiguration </interfacename>annotation. The
15651601
body of the test class itself remains completely unchanged.</para>
1602+
1603+
<!-- TODO Consider documenting inheritance for active profiles. -->
15661604
</section>
15671605

15681606
<section id="testcontext-ctx-management-caching">

0 commit comments

Comments
 (0)