@@ -2907,7 +2907,6 @@ to perform certain actions upon initialization and destruction of your beans.
2907
2907
2908
2908
[TIP]
2909
2909
====
2910
-
2911
2910
The JSR-250 `@PostConstruct` and `@PreDestroy` annotations are generally considered best
2912
2911
practice for receiving lifecycle callbacks in a modern Spring application. Using these
2913
2912
annotations means that your beans are not coupled to Spring specific interfaces. For
@@ -6622,13 +6621,16 @@ The behavior could be different according to the scope of your bean. We are talk
6622
6621
about singletons here.
6623
6622
====
6624
6623
6625
- [NOTE ]
6624
+ [TIP ]
6626
6625
====
6627
6626
There are a few restrictions due to the fact that CGLIB dynamically adds features at
6628
- startup-time:
6627
+ startup-time, in particular that configuration classes must not be final and need to
6628
+ have a default constructor with no arguments.
6629
6629
6630
- * Configuration classes should not be final
6631
- * They should have a constructor with no arguments
6630
+ If you prefer to avoid any CGLIB-imposed limitations, consider declaring your `@Bean`
6631
+ methods on non-`@Configuration` classes, e.g. on plain `@Component` classes instead.
6632
+ Cross-method calls between `@Bean` methods won't get intercepted then, so you'll have
6633
+ to exclusively rely on dependency injection at the field or method level there.
6632
6634
====
6633
6635
6634
6636
@@ -6688,6 +6690,14 @@ This approach simplifies container instantiation, as only one class needs to be
6688
6690
with, rather than requiring the developer to remember a potentially large number of
6689
6691
`@Configuration` classes during construction.
6690
6692
6693
+ [TIP]
6694
+ ====
6695
+ As of Spring Framework 4.2, `@Import` also supports references to regular component
6696
+ classes, analogous to the `AnnotationConfigApplicationContext.register` method.
6697
+ This is particularly useful if you'd like to avoid component scanning, using a few
6698
+ configuration classes as entry points for explicitly defining all your components.
6699
+ ====
6700
+
6691
6701
[[beans-java-injecting-imported-beans]]
6692
6702
===== Injecting dependencies on imported @Bean definitions
6693
6703
0 commit comments