Skip to content

Commit e997e16

Browse files
committed
Merge branch '6.2.x'
2 parents fce0389 + 819a7c8 commit e997e16

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

framework-docs/modules/ROOT/pages/core/beans/dependencies/factory-method-injection.adoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ dynamically generate a subclass that overrides the method.
120120
subclasses cannot be `final`, and the method to be overridden cannot be `final`, either.
121121
* Unit-testing a class that has an `abstract` method requires you to subclass the class
122122
yourself and to supply a stub implementation of the `abstract` method.
123-
* Concrete methods are also necessary for component scanning, which requires concrete
124-
classes to pick up.
125123
* A further key limitation is that lookup methods do not work with factory methods and
126124
in particular not with `@Bean` methods in configuration classes, since, in that case,
127125
the container is not in charge of creating the instance and therefore cannot create
@@ -293,11 +291,6 @@ Kotlin::
293291
----
294292
======
295293

296-
Note that you should typically declare such annotated lookup methods with a concrete
297-
stub implementation, in order for them to be compatible with Spring's component
298-
scanning rules where abstract classes get ignored by default. This limitation does not
299-
apply to explicitly registered or explicitly imported bean classes.
300-
301294
[TIP]
302295
====
303296
Another way of accessing differently scoped target beans is an `ObjectFactory`/

spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -531,9 +531,10 @@ private boolean isConditionMatch(MetadataReader metadataReader) {
531531
}
532532

533533
/**
534-
* Determine whether the given bean definition qualifies as candidate.
535-
* <p>The default implementation checks whether the class is not an interface
536-
* and not dependent on an enclosing class.
534+
* Determine whether the given bean definition qualifies as a candidate component.
535+
* <p>The default implementation checks whether the class is not dependent on an
536+
* enclosing class as well as whether the class is either concrete (and therefore
537+
* not an interface) or has {@link Lookup @Lookup} methods.
537538
* <p>Can be overridden in subclasses.
538539
* @param beanDefinition the bean definition to check
539540
* @return whether the bean definition qualifies as a candidate component

0 commit comments

Comments
 (0)