Polish support for @Import on interfaces
- Update @Import Javadoc - Move tests from ImportSelectorTests to ImportTests See gh-34820
This commit is contained in:
@@ -550,12 +550,13 @@ class ConfigurationClassParser {
|
||||
* <p>For example, it is common for a {@code @Configuration} class to declare direct
|
||||
* {@code @Import}s in addition to meta-imports originating from an {@code @Enable}
|
||||
* annotation.
|
||||
* <p>As of Spring Framework 7.0, {@code @Import} annotations declared on interfaces implemented by
|
||||
* the configuration class are also considered. This allows imports to be triggered
|
||||
* indirectly via marker interfaces or shared base interfaces.
|
||||
* <p>As of Spring Framework 7.0, {@code @Import} annotations declared on interfaces
|
||||
* implemented by the configuration class are also considered. This allows imports to
|
||||
* be triggered indirectly via marker interfaces or shared base interfaces.
|
||||
* @param sourceClass the class to search
|
||||
* @param imports the imports collected so far
|
||||
* @param visited used to track visited classes to prevent infinite recursion
|
||||
* @param visited used to track visited classes and interfaces to prevent infinite
|
||||
* recursion
|
||||
* @throws IOException if there is any problem reading metadata from the named class
|
||||
*/
|
||||
private void collectImports(SourceClass sourceClass, Set<SourceClass> imports, Set<SourceClass> visited)
|
||||
|
||||
@@ -47,6 +47,12 @@ import org.springframework.beans.factory.BeanRegistrar;
|
||||
* directly declared imports to override beans registered via {@code @Import}
|
||||
* meta-annotations.
|
||||
*
|
||||
* <p>As of Spring Framework 7.0, {@code @Import} annotations declared on interfaces
|
||||
* implemented by {@code @Configuration} classes are also supported. Locally declared
|
||||
* {@code @Import} annotations are processed after {@code @Import} annotations on
|
||||
* interfaces, which allows local imports to override beans registered via
|
||||
* {@code @Import} annotations inherited from interfaces.
|
||||
*
|
||||
* <p>If XML or other non-{@code @Configuration} bean definition resources need to be
|
||||
* imported, use the {@link ImportResource @ImportResource} annotation instead.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user