diff --git a/framework-docs/modules/ROOT/pages/appendix.adoc b/framework-docs/modules/ROOT/pages/appendix.adoc index c25f35e2de7f..150bb91e582b 100644 --- a/framework-docs/modules/ROOT/pages/appendix.adoc +++ b/framework-docs/modules/ROOT/pages/appendix.adoc @@ -39,11 +39,6 @@ resolvable otherwise. See {api-spring-framework}++/core/env/AbstractEnvironment.html#IGNORE_GETENV_PROPERTY_NAME++[`AbstractEnvironment`] for details. -| `spring.index.ignore` -| Instructs Spring to ignore the components index located in -`META-INF/spring.components`. See xref:core/beans/classpath-scanning.adoc#beans-scanning-index[Generating an Index of Candidate Components] -. - | `spring.jdbc.getParameterType.ignore` | Instructs Spring to ignore `java.sql.ParameterMetaData.getParameterType` completely. See the note in xref:data-access/jdbc/advanced.adoc#jdbc-batch-list[Batch Operations with a List of Objects]. diff --git a/framework-docs/modules/ROOT/pages/core/beans/classpath-scanning.adoc b/framework-docs/modules/ROOT/pages/core/beans/classpath-scanning.adoc index 6c7f43351bd2..47587713d307 100644 --- a/framework-docs/modules/ROOT/pages/core/beans/classpath-scanning.adoc +++ b/framework-docs/modules/ROOT/pages/core/beans/classpath-scanning.adoc @@ -989,68 +989,4 @@ metadata is provided per-instance rather than per-class. -[[beans-scanning-index]] -== 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 that are targets of component scanning must use this mechanism. - -NOTE: Your existing `@ComponentScan` or `` directives must remain -unchanged to request the context to scan candidates in certain packages. When the -`ApplicationContext` detects such an index, it automatically uses it rather than scanning -the classpath. - -To generate the index, add an additional dependency to each module that contains -components that are targets for component scan directives. The following example shows -how to do so with Maven: - -[source,xml,indent=0,subs="verbatim,quotes,attributes"] ----- - - - org.springframework - spring-context-indexer - {spring-version} - true - - ----- - -With Gradle 4.5 and earlier, the dependency should be declared in the `compileOnly` -configuration, as shown in the following example: - -[source,groovy,indent=0,subs="verbatim,quotes,attributes"] ----- - dependencies { - compileOnly "org.springframework:spring-context-indexer:{spring-version}" - } ----- - -With Gradle 4.6 and later, the dependency should be declared in the `annotationProcessor` -configuration, as shown in the following example: - -[source,groovy,indent=0,subs="verbatim,quotes,attributes"] ----- - dependencies { - annotationProcessor "org.springframework:spring-context-indexer:{spring-version}" - } ----- - -The `spring-context-indexer` artifact generates a `META-INF/spring.components` file that -is included in the jar file. - -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` file is found -on the classpath. If an index is partially available for some libraries (or use cases) -but could not be built for the whole application, you can fall back to a regular classpath -arrangement (as though no index were present at all) by setting `spring.index.ignore` to -`true`, either as a JVM system property or via the -xref:appendix.adoc#appendix-spring-properties[`SpringProperties`] mechanism. - - - diff --git a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java index d9a1fa5af607..87aa1f506d82 100644 --- a/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java +++ b/spring-context-indexer/src/main/java/org/springframework/context/index/processor/CandidateComponentsIndexer.java @@ -42,7 +42,9 @@ * @author Stephane Nicoll * @author Juergen Hoeller * @since 5.0 + * @deprecated as of 6.1, in favor of the AOT engine. */ +@Deprecated(since = "6.1", forRemoval = true) public class CandidateComponentsIndexer implements Processor { private MetadataStore metadataStore; diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java b/spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java index 7c717714c75a..3c56610c9da4 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,6 +86,7 @@ * @see ScannedGenericBeanDefinition * @see CandidateComponentsIndex */ +@SuppressWarnings("removal") // components index public class ClassPathScanningCandidateComponentProvider implements EnvironmentCapable, ResourceLoaderAware { static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; diff --git a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java b/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java index 5d9c0becb112..89d5db248a6e 100644 --- a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java +++ b/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,9 @@ * * @author Stephane Nicoll * @since 5.0 + * @deprecated as of 6.1, in favor of the AOT engine. */ +@Deprecated(since = "6.1", forRemoval = true) public class CandidateComponentsIndex { private static final AntPathMatcher pathMatcher = new AntPathMatcher("."); diff --git a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java b/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java index ee95954b10ee..194c96df705b 100644 --- a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java +++ b/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,10 @@ * * @author Stephane Nicoll * @since 5.0 + * @deprecated as of 6.1, in favor of the AOT engine. */ +@Deprecated(since = "6.1", forRemoval = true) +@SuppressWarnings("removal") public final class CandidateComponentsIndexLoader { /** diff --git a/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexLoaderTests.java b/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexLoaderTests.java index cba866107c7e..cdf78ef84364 100644 --- a/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexLoaderTests.java +++ b/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ * * @author Stephane Nicoll */ +@Deprecated +@SuppressWarnings("removal") public class CandidateComponentsIndexLoaderTests { @Test diff --git a/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexTests.java b/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexTests.java index ab94bfd456e5..803967868007 100644 --- a/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexTests.java +++ b/spring-context/src/test/java/org/springframework/context/index/CandidateComponentsIndexTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,8 @@ * * @author Stephane Nicoll */ +@Deprecated +@SuppressWarnings("removal") public class CandidateComponentsIndexTests { @Test diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesScanner.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesScanner.java index 48b5d11fa6d3..1686b9c2fb22 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesScanner.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,6 +52,7 @@ * @author Stephane Nicoll * @since 6.0 */ +@SuppressWarnings("removal") // components index public final class PersistenceManagedTypesScanner { private static final String CLASS_RESOURCE_PATTERN = "/**/*.class";