日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

JDK和Spring中的设计模式

發布時間:2023/12/13 javascript 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JDK和Spring中的设计模式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

JDK中的設計模式(17)

創建型

1)工廠方法

Collection.iterator() 由具體的聚集類來確定使用哪一個Iterator

2)單例模式

Runtime.getRuntime()

3)建造者模式

StringBuilder

4)原型模式

Java中的Cloneable

結構性

1)適配器模式

InputStreamReader

OutputStreamWriter

RunnableAdapter

2)裝飾器模式

io包 FileInputStream BufferedInputStream

3)代理模式

動態代理;RMI

4)外觀模式

java.util.logging

5)橋接模式

JDBC

6)組合模式

dom

7)享元模式

Integer.valueOf

行為型

1)策略模式

線程池的四種拒絕策略

2)模板方法模式

AbstractList、AbstractMap等

InputStream、OutputStream

AQS

3)觀察者模式

Swing中的Listener

4)迭代器模式

集合類中的iterator

5)責任鏈模式

J2EE中的Filter

6)命令模式

Runnable、Callable,ThreadPoolExecutor

7)備忘錄模式

8)狀態模式

9)訪問者模式

10)中介者模式

11)解釋器模式

?

?

Spring中的設計模式(6)

1)抽象工廠模式:

BeanFactory

2)代理模式:

AOP

3)模板方法模式:

AbstractApplicationContext中定義了一系列的抽象方法,比如refreshBeanFactory、closeBeanFactory、getBeanFactory。

4)單例模式:

Spring可以管理單例對象,控制對象為單例

5)原型模式:

Spring可以管理多例對象,控制對象為prototype

6)適配器模式:

Advice與Interceptor的適配

Adapter類接口Target

public interface AdvisorAdapter { boolean supportsAdvice(Advice advice);MethodInterceptor getInterceptor(Advisor advisor); }?

MethodBeforeAdviceAdapterAdapter

class MethodBeforeAdviceAdapter implements AdvisorAdapter, Serializable {public boolean supportsAdvice(Advice advice) {return (advice instanceof MethodBeforeAdvice);}public MethodInterceptor getInterceptor(Advisor advisor) {MethodBeforeAdvice advice = (MethodBeforeAdvice) advisor.getAdvice();return new MethodBeforeAdviceInterceptor(advice);} }

?

?

慢慢填坑

總結

以上是生活随笔為你收集整理的JDK和Spring中的设计模式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。