Spring Learning Diary
来源:互联网 发布:移动网络怎么样天津 编辑:程序博客网 时间:2024/05/10 12:15
Spring 基础
依赖检查属性
在bean的dependency-check属性中指定依赖检查模式就ok.依赖检查模式有none, simple, object 和 all.
注意的是依赖检查只是检查属性是否通过设值方法注入。
@Required和自定义注解检查属性
需要先在Bean配置文件中添加<context:annotation-config>
@Required注解适用于bean属性的setter方法并且它指示,受影响的bean属性必须在配置时被填充在XML配置文件中,否则容器将抛出BeanInitializationException例外。
自定义:
@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.METHOD)public @interface AA{}
在使用自定义的注解的时候,需要在 RequiredAnnotationBeanPostProcessor的requiredAnnotationType 属性中指定。
<bean class="Org.springframework.beans.factory.annonotation.RequiredAnnotationBeanPostProcessor"><property name="requiredAnnotationType"> <value>com.***.AA</value></property></bean>
自动装配
- 在bean属性中指定autowire类型
- 使用@Autowired和@Resource装配特定属性—-需要先在Bean配置文件中添加
<context:annotation-config>
0 0
- Spring Learning Diary
- Spring MVC And Java Web Learning Diary
- Learning English grow diary
- diary
- diary
- Diary
- diary
- diary
- diary
- diary
- Diary
- Diary
- Diary
- swift learning diary: dismiss the keyboard by touching background
- Spring Learning
- RE learning Diary . 1__remove the pop-up adds of WinRar
- work diary
- my diary
- Java实现单点登录
- spring boot 基础日志配置
- php日期函数与php时间函数
- Apache Storm 2.0.0-SNAPSHOT源码分析笔记(一)
- Problem A
- Spring Learning Diary
- UICollectionView的基本使用(一)
- 解读(三):分析MainActivity, 程序的界面主体框架
- Android bluetooth介绍(一):基本概念及硬件接口
- 删除群成员导致的数据错乱
- 关于Ajax异步分页的一点点总结
- 线程池.(Executors,ThreadPoolExecutor,BlockingQueue,RejectedExecutionHandler).介绍
- CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate)
- HDU 1303 Doubles(水题)