天天看點

設計模式學習之路-工廠模式實際使用場景

工廠模式屬于建立型模式,目的為建立對象提供過渡接口,以便将建立對象的具體過程屏蔽隔離起來,提高靈活性。

工廠模式分為三類(從上到下越來越抽象):

簡單工廠模式 simple factory 又稱靜态工廠方法模式

工廠方法模式 factory method

抽象工廠模式 abstract factory

spring核心容器的主要元件是beanfactory,它是工廠模式的實作。

參考連結

<a href="http://design-patterns.readthedocs.io/zh_cn/latest/creational_patterns/simple_factory.html">http://design-patterns.readthedocs.io/zh_cn/latest/creational_patterns/simple_factory.html</a>

<a href="https://yq.aliyun.com/articles/109934">https://yq.aliyun.com/articles/109934</a>