Mybatis used to design pattern

1. configured by mode:

Constructors mode is in the process of mybatis initialization mapper mapping file, create a Cache object is <cache> node way is constructed by mode. Which CacheBilder role for the construction, Cache object is a product role

2 Decorator

Cache implement multiple interfaces, but most of them are decorators, only PerpetualCache provides a basic implementation of the Cache interface, all the other decorators provides some additional features on the basis of PerpetualCache through the various combinations to meet a specific demand

3 factory method pattern

mybatis in the DataSource created using a factory method pattern, then what class which played a role in this mode it?

Factory Interface (Factory's): DataSourceFactory factory interface role to play

DETAILED factory class (ConcreteFactory): UnpooledDataSourceFactory and PooledDataSourceFactory

Product Interface roles (Product): java.sql.DataSource

Role-specific products (ConcreteFactory): UnpooledDataSource and PooledDataSource

https://www.cnblogs.com/51life/p/9543280.html

 

Guess you like

Origin www.cnblogs.com/lingcheng7777/p/12031494.html