onlyliuxin / coding2017

218 stars 643 forks source link

spring框架中常用的设计模式有哪些?并举例,面试问的哦 #504

Open ouysl opened 7 years ago

ouysl commented 7 years ago

工厂模式,bean

hashRui commented 7 years ago

从最简单的开始,getBean() 获取单例, 建议先看看单例模式的几种写法,然后再去学习spring是如何获取bean的, http://www.tuicool.com/articles/mmQNBvz http://www.tuicool.com/articles/mmQNBvz http://geeekr.com/read-spring-source-1-how-to-load-bean/

ouysl commented 7 years ago

代理模式?

xdx54321 commented 7 years ago

动态代理

ouysl commented 7 years ago

AOP动态代理

GordenChow commented 7 years ago

凑个热闹,依赖注入是用动态代理实现的,拦截器用责任链模式实现的,另外还有单例模式,工厂模式

caozhao2017Java commented 7 years ago

去年面试 也有过 问到 设计模式,被问到 简单工厂 策略模式 代理模式,写 简单代码例子 然后解释,面试多提 自己知道的