06 2018 档案

摘要:利用Spring MVC的过滤器及token传递验证来实现表单防重复提交。 创建注解 @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Token { boole 阅读全文
posted @ 2018-06-05 15:16 章鱼哥哥 阅读(216) 评论(0) 推荐(0) 编辑
摘要:@Controller 用来表示一个web控制层bean,如SpringMvc中的控制器。 @Service 用来表示一个业务层bean。 @Repository 用来表示一个持久层bean,即数据访问层DAO组件。 @Component 用来表示一个平常的普通组件,当一个类不合适用以上的注解定义时 阅读全文
posted @ 2018-06-05 15:07 章鱼哥哥 阅读(255) 评论(0) 推荐(0) 编辑
摘要:Enable* 之前的文章用到了一些Enable*开头的注解,比如EnableAsync、EnableScheduling、EnableAspectJAutoProxy、EnableCaching等,Enable表示开启/允许一项功能。 Enable*工作原理 我们只需要几个很简单的注解就能开启一个 阅读全文
posted @ 2018-06-05 14:59 章鱼哥哥 阅读(206) 评论(0) 推荐(0) 编辑
摘要:Spring Aware是什么 Spring提供Aware接口能让Bean感知Spring容器的存在,即让Bean可以使用Spring容器所提供的资源。 Spring Aware的分类 几种常用的Aware接口如下。 更多的可以看它的继承图。 Spring Aware的使用 如要获取容器中的某个Be 阅读全文
posted @ 2018-06-01 16:09 章鱼哥哥 阅读(216) 评论(0) 推荐(0) 编辑
摘要:@EnableAsync @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Import(AsyncConfigurationSelector.class) public @interface Ena 阅读全文
posted @ 2018-06-01 15:32 章鱼哥哥 阅读(301) 评论(0) 推荐(0) 编辑
摘要:使用Spring Aop注解的时候,如@Transactional, @Cacheable等注解一般需要在类方法第一个入口的地方加,不然不会生效。 如下面几种场景 1、Controller直接调用Service B方法:Controller > Service A 在Service A 上加@Tra 阅读全文
posted @ 2018-06-01 15:29 章鱼哥哥 阅读(2572) 评论(0) 推荐(0) 编辑
摘要:概况 @Resource,@Autowired,@Inject 这3种都是用来注入bean的,它们属于不同的程序中。 JSR是Java Specification Requests的缩写,意思是Java 规范提案。是指向JCP(Java Community Process)提出新增一个标准化技术规范 阅读全文
posted @ 2018-06-01 10:41 章鱼哥哥 阅读(1560) 评论(2) 推荐(0) 编辑
摘要:1.实例化BeanFactoryPostProcessor 的实现类; 2.执行BeanFactoryPostProcessor 的postProcesserBeanFactory方法; 3.实例化BeanPostProcessor实现类; 4.实例化InstantiationAwareBeanpo 阅读全文
posted @ 2018-06-01 10:39 章鱼哥哥 阅读(190) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示