22= The IoC container
33
44
5+
6+
57[[beans-introduction]]
68== Introduction to the Spring IoC container and beans
79
@@ -400,6 +402,7 @@ a dependency on a specific bean through metadata (e.g. an autowiring annotation)
400402
401403[[beans-definition]]
402404== Bean overview
405+
403406A Spring IoC container manages one or more __beans__. These beans are created with the
404407configuration metadata that you supply to the container, for example, in the form of XML
405408`<bean/>` definitions.
@@ -778,6 +781,7 @@ Spring container that will create objects through an
778781
779782[[beans-dependencies]]
780783== Dependencies
784+
781785A typical enterprise application does not consist of a single object (or bean in the
782786Spring parlance). Even the simplest application has a few objects that work together to
783787present what the end-user sees as a coherent application. This next section explains how
@@ -2380,6 +2384,7 @@ shortest string that will match an argument type.
23802384
23812385[[beans-factory-scopes]]
23822386== Bean scopes
2387+
23832388When you create a bean definition, you create a __recipe__ for creating actual instances
23842389of the class defined by that bean definition. The idea that a bean definition is a
23852390recipe is important, because it means that, as with a class, you can create many object
@@ -3602,6 +3607,7 @@ beans that require programmatic access to the container.
36023607
36033608[[beans-child-bean-definitions]]
36043609== Bean definition inheritance
3610+
36053611A bean definition can contain a lot of configuration information, including constructor
36063612arguments, property values, and container-specific information such as initialization
36073613method, static factory method name, and so on. A child bean definition inherits
@@ -3687,6 +3693,7 @@ context will actually (attempt to) pre-instantiate the `abstract` bean.
36873693
36883694[[beans-factory-extension]]
36893695== Container Extension Points
3696+
36903697Typically, an application developer does not need to subclass `ApplicationContext`
36913698implementation classes. Instead, the Spring IoC container can be extended by plugging in
36923699implementations of special integration interfaces. The next few sections describe these
@@ -5173,6 +5180,7 @@ For details about the effects of combining various lifecycle mechanisms, see
51735180
51745181[[beans-classpath-scanning]]
51755182== Classpath scanning and managed components
5183+
51765184Most examples in this chapter use XML to specify the configuration metadata that produces
51775185each `BeanDefinition` within the Spring container. The previous section
51785186(<<beans-annotation-config>>) demonstrates how to provide a lot of the configuration
@@ -5299,6 +5307,7 @@ https://github.com/spring-projects/spring-framework/wiki/Spring-Annotation-Progr
52995307wiki page.
53005308
53015309
5310+
53025311[[beans-scanning-autodetection]]
53035312=== Automatically detecting classes and registering bean definitions
53045313
@@ -5839,6 +5848,7 @@ metadata is provided per-instance rather than per-class.
58395848
58405849[[beans-scanning-index]]
58415850=== Generating an index of candidate components
5851+
58425852While classpath scanning is very fast, it is possible to improve the startup performance
58435853of large applications by creating a static list of candidates at compilation time. In this
58445854mode, _all modules_ of the application must use this mechanism as, when the
@@ -5893,8 +5903,10 @@ classpath.
58935903
58945904
58955905
5906+
58965907[[beans-standard-annotations]]
58975908== Using JSR 330 Standard Annotations
5909+
58985910Starting with Spring 3.0, Spring offers support for JSR-330 standard annotations
58995911(Dependency Injection). Those annotations are scanned in the same way as the Spring
59005912annotations. You just need to have the relevant jars in your classpath.
@@ -6742,6 +6754,7 @@ annotation can be used:
67426754----
67436755
67446756
6757+
67456758[[beans-java-configuration-annotation]]
67466759=== Using the @Configuration annotation
67476760
@@ -7979,7 +7992,7 @@ AspectJ load-time weaving, see <<aop-aj-ltw>>.
79797992
79807993
79817994[[context-introduction]]
7982- == Additional Capabilities of the ApplicationContext
7995+ == Additional capabilities of the ApplicationContext
79837996
79847997As was discussed in the chapter introduction, the `org.springframework.beans.factory`
79857998package provides basic functionality for managing and manipulating beans, including in a
@@ -8211,7 +8224,7 @@ out the `ReloadableResourceBundleMessageSource` javadocs for details.
82118224
82128225
82138226[[context-functionality-events]]
8214- === Standard and Custom Events
8227+ === Standard and custom events
82158228
82168229Event handling in the `ApplicationContext` is provided through the `ApplicationEvent`
82178230class and `ApplicationListener` interface. If a bean that implements the
@@ -8400,8 +8413,9 @@ http://www.enterpriseintegrationpatterns.com[pattern-oriented], event-driven
84008413architectures that build upon the well-known Spring programming model.
84018414====
84028415
8416+
84038417[[context-functionality-events-annotation]]
8404- ==== Annotation-based Event Listeners
8418+ ==== Annotation-based event listeners
84058419
84068420As of Spring 4.2, an event listener can be registered on any public method of a managed
84078421bean via the `EventListener` annotation. The `BlackListNotifier` can be rewritten as
@@ -8508,6 +8522,7 @@ This new method will publish a new `ListUpdateEvent` for every `BlackListEvent`
85088522by the method above. If you need to publish several events, just return a `Collection` of
85098523events instead.
85108524
8525+
85118526[[context-functionality-events-async]]
85128527==== Asynchronous Listeners
85138528
@@ -8534,7 +8549,7 @@ Be aware of the following limitations when using asynchronous events:
85348549
85358550
85368551[[context-functionality-events-order]]
8537- ==== Ordering Listeners
8552+ ==== Ordering listeners
85388553
85398554If you need the listener to be invoked before another one, just add the `@Order`
85408555annotation to the method declaration:
@@ -8549,8 +8564,9 @@ annotation to the method declaration:
85498564 }
85508565----
85518566
8567+
85528568[[context-functionality-events-generics]]
8553- ==== Generic Events
8569+ ==== Generic events
85548570
85558571You may also use generics to further define the structure of your event. Consider an
85568572`EntityCreatedEvent<T>` where `T` is the type of the actual entity that got created. You
@@ -8716,14 +8732,15 @@ be used by other application modules on the same machine.
87168732
87178733[[beans-beanfactory]]
87188734== The BeanFactory
8735+
87198736The `BeanFactory` provides the underlying basis for Spring's IoC functionality but it is
87208737only used directly in integration with other third-party frameworks and is now largely
87218738historical in nature for most users of Spring. The `BeanFactory` and related interfaces,
87228739such as `BeanFactoryAware`, `InitializingBean`, `DisposableBean`, are still present in
87238740Spring for the purposes of backward compatibility with the large number of third-party
87248741frameworks that integrate with Spring. Often third-party components that can not use
8725- more modern equivalents such as `@PostConstruct` or `@PreDestroy` in order to remain
8726- compatible with JDK 1.4 or to avoid a dependency on JSR-250.
8742+ more modern equivalents such as `@PostConstruct` or `@PreDestroy` in order to avoid a
8743+ dependency on JSR-250.
87278744
87288745This section provides additional background into the differences between the
87298746`BeanFactory` and `ApplicationContext` and how one might access the IoC container
0 commit comments