Polish components indexer doc

Issue: SPR-15793
This commit is contained in:
Stephane Nicoll 2017-07-19 10:05:09 +02:00
parent fb4ddb0746
commit 19c88f2cfa
1 changed files with 13 additions and 6 deletions

View File

@ -5864,12 +5864,12 @@ metadata is provided per-instance rather than per-class.
[[beans-scanning-index]]
=== Generating a index of candidate components
Rather than scanning the classpath to find components, it is also possible to generate an
index at compilation time. When the `ApplicationContext` detects such index it will
automatically use it rather than scanning the classpath. This can reduce the time required
to refresh the `ApplicationContext` as scanning large applications can take a significant
amount of time.
=== Generating an index of candidate components
While classpath scanning is very fast, it is possible to improve the startup performance
of large applications by creating a static list of candidates at compilation time. In this
mode, _all modules_ of the application must use this mechanism as, when the
`ApplicationContext` detects such index, it will automatically use it rather than scanning
the classpath.
To generate the index, simply add an additional dependency to each module that contains
components that are target for component scan directives:
@ -5900,6 +5900,13 @@ Or, using Gradle:
That process will generate a `META-INF/spring.components` file that is going to be
included in the jar.
[NOTE]
====
When working with this mode in your IDE, the `spring-context-indexer` must be registered
as an annotation processor to make sure the index is up to date when candidate components
are updated.
====
[TIP]
====
The index is enabled automatically when a `META-INF/spring.components` is found on the