1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update spring-design-patterns-summary.md

This commit is contained in:
Jarvan-Song 2022-03-16 16:09:16 +08:00 committed by GitHub
parent 93266231c3
commit cb1f7e6e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ public Object getSingleton(String beanName, ObjectFactory<?> singletonFactory) {
AOP(Aspect-Oriented Programming:面向切面编程)能够将那些与业务无关,**却为业务模块所共同调用的逻辑或责任(例如事务处理、日志管理、权限控制等)封装起来**,便于**减少系统的重复代码****降低模块间的耦合度**,并**有利于未来的可拓展性和可维护性**。
**Spring AOP 就是基于动态代理的**如果要代理的对象实现了某个接口那么Spring AOP会使用**JDK Proxy**,去创建代理对象,而对于没有实现接口的对象,就无法使用 JDK Proxy 去进行代理了这时候Spring AOP会使用**Cglib** 这时候Spring AOP会使用 **Cglib** 生成一个被代理对象的子类来作为代理,如下图所示:
**Spring AOP 就是基于动态代理的**如果要代理的对象实现了某个接口那么Spring AOP会使用**JDK Proxy**,去创建代理对象,而对于没有实现接口的对象,就无法使用 JDK Proxy 去进行代理了这时候Spring AOP会使用 **Cglib** 生成一个被代理对象的子类来作为代理,如下图所示:
![SpringAOPProcess](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/SpringAOPProcess.jpg)