Spring Core文档

 

  1. 花了一个月看spring core的文档,最终算是翻了一遍,记录一下

  2. 如果遇到前两个字母都是大写,那么spring容器里面bean的名字就保持不变。

  3. Spring容器在创建的时候会验证bean的配置,但是并不会设置它的属性;真正的属性的设置也就是这个bean的真正创建会等到使用的时候,那个时候创建的是一个bean的索引(a依赖b,b依赖c)

  4. 构造函数注入会出现循环引用的问题,但是set注入不会

  1. depends-on可以强迫在使用这个类之前进行初始化

  2. applicationContext一般会把单例的类在容器初始化的过程中初始化,但是如果加上懒加载标志,可以到用的时候再初始化

  1. 为了每次都拿到一个新的bean实例,直接使用getBean可以吗

  2. xml的lookup是可以由框架提供实现,但是@lookup不行,spring container会忽略abstract,所以要自己提供实现。

  3. lookup的需要类是单例,那么框架的实现返回的也是单例,这里的单例应该是指的函数本身。???

  4. beanPostProcessor, 里面的before方法,是在bean的初始化函数之前,不是这个bean的创立之前。所有的函数都需要在bean的创建之上才会调用。

  5. 注解在xml配置之前,所以xml配置会覆盖注解。

  6. 如果一个bean有多个constructor,那么要用的那个使用@autowired

  7. @autowired可以注入一个数组或者set

  8.  

  9. @Repository, @Service, and @Controller are specializations of @Component for more specific use cases 

  10. annotation的原理

            看似注解的声明比较简单,但是对于的处理器呢

  1. requestParam里面也可以传对象(数组)

  2. The use of <context:component-scan> implicitly enables the functionality of <context:annotation-config>. There is usually no need to include the <context:annotation-config> element when using <context:component-scan>

  1. 文档里面主要IOC,AOP是主要,占据三分之二的篇幅。还有Resource,也只看了这三部分

  2. AOP和DI是一个意思

The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container. 

The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container. The BeanFactory interface provides an advanced configuration mechanism capable of managing any type of object.ApplicationContext is a sub-interface of BeanFactory. It adds:

  • Easier integration with Spring’s AOP features

  • Message resource handling (for use in internationalization)

  • Event publication

  • Application-layer specific contexts such as the WebApplicationContext for use in web applications.

ApplicationContextAware and BeanNameAware

定制化一个bean(init和destroy)

 Customizing Beans by Using a BeanPostProcessor

 

beanfactorypostprocessor

 

 

存疑: 

 

ApplicationContextAware 有什么用

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值