@@ -2032,15 +2032,17 @@ overrides the method.
2032
2032
2033
2033
[NOTE]
2034
2034
====
2035
- For this dynamic subclassing to work, the class that the Spring container will subclass
2036
- cannot be `final`, and the method to be overridden cannot be `final` either. Also,
2037
- testing a class that has an `abstract` method requires you to subclass the class
2038
- yourself and to supply a stub implementation of the `abstract` method. Finally, objects
2039
- that have been the target of method injection cannot be serialized. As of Spring 3.2 it
2040
- is no longer necessary to add CGLIB to your classpath, because CGLIB classes are
2041
- repackaged under org.springframework and distributed within the spring-core JAR. This is
2042
- done both for convenience as well as to avoid potential conflicts with other projects
2043
- that use differing versions of CGLIB.
2035
+ * For this dynamic subclassing to work, the class that the Spring bean container will
2036
+ subclass cannot be `final`, and the method to be overridden cannot be `final` either.
2037
+ * Unit-testing a class that has an `abstract` method requires you to subclass the class
2038
+ yourself and to supply a stub implementation of the `abstract` method.
2039
+ * Concrete methods are also necessary for component scanning which requires concrete
2040
+ classes to pick up.
2041
+ * A further key limitation is that lookup methods won't work with factory methods and
2042
+ in particular not with `@Bean` methods in configuration classes, since the container
2043
+ is not in charge of creating the instance in that case and therefore cannot create
2044
+ a runtime-generated subclass on the fly.
2045
+ * Finally, objects that have been the target of method injection cannot be serialized.
2044
2046
====
2045
2047
2046
2048
Looking at the `CommandManager` class in the previous code snippet, you see that the
@@ -2116,7 +2118,7 @@ these classes for additional information.
2116
2118
2117
2119
[[beans-factory-arbitrary-method-replacement]]
2118
2120
==== Arbitrary method replacement
2119
- A less useful form of method injection than lookup method Injection is the ability to
2121
+ A less useful form of method injection than lookup method injection is the ability to
2120
2122
replace arbitrary methods in a managed bean with another method implementation. Users
2121
2123
may safely skip the rest of this section until the functionality is actually needed.
2122
2124
0 commit comments