随笔分类 -  spring

摘要:@Profile的作用: Spring容器根据标识激活对应的profile注解,其关联的bean才会被注册到容器中。最常见的用途是区分开发环境,测试环境,生产环境信息 阅读全文
posted @ 2019-07-17 11:27 兵哥无敌 阅读(559) 评论(0) 推荐(0)
摘要:Spring Condition注解的主要作用是根据条件给容器注入bean,简称条件注解。它是spring 4.0引入的新特性 Match 实现了Condition,重写 matches方法,当该方法返回true的时候,表示条件满足。 从参数context里面可以获取 1.context.getEn 阅读全文
posted @ 2019-07-17 09:59 兵哥无敌 阅读(1547) 评论(0) 推荐(0)
摘要:spring容器中bean的初始化方式大体有三种: @PostConstruct ,@PreDestroy: 从Java EE5规范开始,Servlet中增加了两个影响Servlet生命周期的注解,@PostConstruct和@PreDestroy。@PostConstruct会在Servlet构 阅读全文
posted @ 2019-06-17 18:15 兵哥无敌 阅读(11602) 评论(0) 推荐(0)
摘要:spring 中常用的组件标签有: @Controller:控制层 @Service:业务层 @Repository:数据层 @Component:普通的pojo注入到spring容器 组件注册方式: @ComponentScan 扫描那些要注入到spring容器的组件的包路径 package co 阅读全文
posted @ 2019-06-12 16:59 兵哥无敌 阅读(1343) 评论(0) 推荐(0)