background
Programmers in the project combat, strategy pattern used very much.
learning target
-
Strategies are used to model the project in Spring
Code examples
Ado, java software development attention to it, drive it
Here is a query business case using the strategy pattern
A concrete realization of inquiry service
Realization of inquiry service B
C realization of inquiry service
This is a sub-class of business inquiries call three parts
-
1. Fill the list of sub-query business objects
-
2 is provided into the reference
-
3. Cycle call subclass, [now verified, then call processing logic]
Spring configuration file description
This is the mode of application strategy
The above is a list of policy mode, but also examples of staff map
Now speak the profile, a good understanding of key / value format.
This strategy is the application of Map mode, the front steps 1 and 2 are the same, step 3 is not a cycle call, a single call.