Spring-扩展点
参考文献
常用
自定义拦截器
-
Spring MVC
拦截器的顶层接口是:HandlerInterceptor
,包含三个方法:preHandle
目标方法执行前执行postHandle
目标方法执行后执行afterCompletion
请求完成时执行
-
一般情况会用
HandlerInterceptor
接口的实现类HandlerInterceptorAdapter
类。
获取Spring容器对象
BeanFactoryAware
接口
1 |
|
ApplicationContextAware
接口
1 |
|
ApplicationListener
接口
1 |
|
初始化方法
-
目前Spring中使用比较多的初始化Bean的方法有:
-
使用
@PostConstruct
注解 -
实现
InitializingBean
接口
-
不常用
BeanFactory
扩展
BeanFactoryPostProcessor
BeanDefinitionRegistryPostProcessor
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 HoleLin's Blog!