Skip to content

Commit 5ee89a3

Browse files
committed
Polish explanation of the 'default' profile
Issue: SPR-11256
1 parent bac9f43 commit 5ee89a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/asciidoc/index.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19047,20 +19047,20 @@ When `TransferServiceTest` is run, its `ApplicationContext` will be loaded from
1904719047
`app-config.xml` configuration file in the root of the classpath. If you inspect
1904819048
`app-config.xml` you'll notice that the `accountRepository` bean has a dependency on a
1904919049
`dataSource` bean; however, `dataSource` is not defined as a top-level bean. Instead,
19050-
`dataSource` is defined three times, that is the __production__ profile, the
19051-
__dev__ profile and the __default__ profile.
19050+
`dataSource` is defined three times: in the __production__ profile, the
19051+
__dev__ profile, and the __default__ profile.
1905219052

1905319053
By annotating `TransferServiceTest` with `@ActiveProfiles("dev")` we instruct the Spring
1905419054
TestContext Framework to load the `ApplicationContext` with the active profiles set to
19055-
`{"dev"}`. As a result, an embedded database will be created, and the
19056-
`accountRepository` bean will be wired with a reference to the development `DataSource`.
19057-
And that's likely what we want in an integration test.
19055+
`{"dev"}`. As a result, an embedded database will be created and populated with test data,
19056+
and the `accountRepository` bean will be wired with a reference to the development
19057+
`DataSource`. And that's likely what we want in an integration test.
1905819058

1905919059
It is sometimes useful to assign beans to a `default` profile. Beans within the default profile
1906019060
are only included when no other profile is specifically activated. This can be used to define
1906119061
_fallback_ beans to be used in the application's default state. For example, you may
1906219062
explicitly provide a data source for `dev` and `production` profiles, but define an in-memory
19063-
data source as a default when neither of these are specified.
19063+
data source as a default when neither of these is active.
1906419064

1906519065
The following code listings demonstrate how to implement the same configuration and
1906619066
integration test but using `@Configuration` classes instead of XML.

0 commit comments

Comments
 (0)