摘要: Spring Aware是什么 Spring提供Aware接口能让Bean感知Spring容器的存在,即让Bean可以使用Spring容器所提供的资源。 Spring Aware的分类 几种常用的Aware接口如下。 更多的可以看它的继承图。 Spring Aware的使用 如要获取容器中的某个Be 阅读全文
posted @ 2018-06-01 16:09 章鱼哥哥 阅读(210) 评论(0) 推荐(0) 编辑
摘要: @EnableAsync @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Import(AsyncConfigurationSelector.class) public @interface Ena 阅读全文
posted @ 2018-06-01 15:32 章鱼哥哥 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 使用Spring Aop注解的时候,如@Transactional, @Cacheable等注解一般需要在类方法第一个入口的地方加,不然不会生效。 如下面几种场景 1、Controller直接调用Service B方法:Controller > Service A 在Service A 上加@Tra 阅读全文
posted @ 2018-06-01 15:29 章鱼哥哥 阅读(2547) 评论(0) 推荐(0) 编辑
摘要: 概况 @Resource,@Autowired,@Inject 这3种都是用来注入bean的,它们属于不同的程序中。 JSR是Java Specification Requests的缩写,意思是Java 规范提案。是指向JCP(Java Community Process)提出新增一个标准化技术规范 阅读全文
posted @ 2018-06-01 10:41 章鱼哥哥 阅读(1550) 评论(2) 推荐(0) 编辑
摘要: 1.实例化BeanFactoryPostProcessor 的实现类; 2.执行BeanFactoryPostProcessor 的postProcesserBeanFactory方法; 3.实例化BeanPostProcessor实现类; 4.实例化InstantiationAwareBeanpo 阅读全文
posted @ 2018-06-01 10:39 章鱼哥哥 阅读(187) 评论(0) 推荐(0) 编辑