Expert Spring MVC and Web Flow

(Dana P.) #1

technique also allows you to create modular configurations of request handlers and then
chain them together at runtime.
The DispatcherServletsearches for its components using the algorithm pictured in
Figure 5-1. The path through the algorithm is dependent on many factors, including if multi-
ple components of the same type can be detected and if there is a default strategy available if
none are found in the ApplicationContext. For many types of components, if you disable the
automatic detection by type, then the DispatcherServletwill fall back to searching for a single
component with a well-known bean name.
Table 5-1 lists the discovery rules and interfaces of the components managed by the
DispatcherServlet.


Figure 5-1.DispatcherServlet discovery of components algorithm


Get default component

Detect single by name

DispatcherServlet Init

[None found]

[Detect all = false]

[Unable to detect all]

[Detect all = true]

[Component located]

[No default strategy]

[Component not found]

[Able to detect all]

[Configurable detect all]

[Has default strategy]

Detect multiple components of the same type

[Only detect all]

order

[Found one or more]

CHAPTER 5 ■THE PROCESSING PIPELINE 81
Free download pdf