文章目录
- Spring-framework 核心
-
- AOP
- AOP API
- Bean Overview——IoC注册bean
- Bean Scope——Bean的作用范围
- Customizing the Nature of a Bean——Bean的生命周期
- Container Extension Points——生成bean过程中的自定义拓展功能
- Annotation-based Container Configuration——使用注解对Bean进行依赖注入
- Classpath Scanning and Managed Components——使用注解注册Bean
- Java-based Container Configuration——使用注解配置容器
- Additional Capabilities of the ApplicationContext——容器的拓展功能
- Resources——spring处理文件的方式
- Validation by Using Spring's Validator Interface——校验器
- PropertiesEditor、Type Conversion、Formatter——属性编辑、类型转换与格式化
- Java Bean Validation——bean校验
- Cache
- 单元测试
- 其他
- Data Access
- 文件读取
- Spring MVC
- Spring web
- Spring webflux
- Spring-Log
- 常用注解
- Spring-JDBC
- SpringBoot Actuator
- SpringBoot
- spring-boot-starter-thymeleaf
- Spring-boot-oauth2
- Spring-Validator
Spring-framework 核心
AOP
细说Spring——AOP详解(AOP概览)
切入点表达式需要一个aspectjweaver
包
Spring AOP 笔记三(引入Introductions)
Spring-AOP @AspectJ切点函数之target()和this()
Spring AOP target() vs this()
spring里多数情况下这俩东西没区别,不过Stack Overflow里的回答说的很好,首先target
指的是被代理的按个对象,而this
实际上指的是代理对象proxy
,target(clazz)
表示的是被代理对象是clazz
这个类的话会触发aop
,this(class)
表示的是proxy
是clazz
这个类的话会触发aop
AOP API
深入理解Spring AOP-基于API编程
Spring AOP的Advice接口设计
Spring源码:Advice接口
class SimplePojo implements Pojo{
}
ProxyFactory factory = new ProxyFactory(new SimplePojo());
factory.addInterface(Pojo.class);
factory.addAdvice(new MyAdvice());
Pojo pojo=(Pojo)factory.getProxy();
pojo.foo();
【框架】[Spring]纯Java方式实现AOP拦截-详解ThrowsAdvice异常通知
Note that this means that the org.springframework.aop.ThrowsAdvice
interface does not contain any methods. It is a tag interface identifying that the given object implements one or more typed throws advice methods.
Bean Overview——IoC注册bean
spring中factory-method使用
关于spring配置文件中读取${username}为系统当前用户名的问题
Spring的Bean加载流程
Spring 是如何解决循环依赖的?
Bean Scope——Bean的作用范围
关于registerSingleton()方法的缺点
Spring-AOP标签scoped-proxy
Spring当中aop:scoped-proxy 的用法
Spring——<aop:scoped-proxy/>
理解
当向长生命周期的bean(假如说singleton-scoped的对象A
)注入一个短生命周期的bean(假如说session-scoped的对象B
)的时候,如下所示
<bean id="controller" class="controller.Controller" scope="session">
</bean>
<bean id="singletonController" class="controller.SingletonController">
<property name="controller" ref="controller"/>
</bean>
这会引出一个问题,容器创建的时候,没有用户访问网页,对象B
并没有创建,那么对于对象A
的依赖注入会失败,所以会报错:consider defining a scoped proxy for this bean if you intend to refer to it from a singleton
,改成下面的方式即可。所以说<aop:scoped-proxy />
的功能就是让容器生成一个controller
的代理对象,这个代理对象能够配合singleController
的生命周期完成注入,当调用其方法的时候,实际调用的是真实的controller
自己的方法
<bean id="controller" class="controller.Controller" scope="session">
<aop:scoped-proxy />
</bean>
<bean id="singletonController" class="controller.SingletonController">
<property name="controller