spring学习笔记
spring学习笔记 1.XML里配置bean的scope,一般常用的singleton(默认)和prototype(原型)。 singleton对应一个对象实例,单例;prototype对应多个对象实例。
2.By default, classes annotated with** @Component, @Repository, @Service, or @Controller **are the only detected candidate components.(是唯一会被检测到的候选组件)。
3.@Resource(重要) a)加入:j2ee/common-annotations.jar b)默认按名称,找不到再类型 c)可以指定特定名称**:@Resource(name="userDAO")** d)推荐使用 e)不足:如果没有源码,就无法运用annotation,只能使用xml
4.@Component @Service @Controller @Repository,写在class定义上面 a)初始化的名字默认为类名首字母小写 b)可以指定初始化bean的名字**:@Component("userService")**
5.搞懂动态代理,反射的概念,再就是AOP。