Spring
一:Spring核心
Spring实现简化开发的四项策略:
1、基于POJO的轻量级和最小侵入式编程;
2、通过依赖注入和面向接口编程实现松耦合;
3、基于切面和惯例进行声明式编程;
4、通过切面和模板减少样板式代码。
beanFactory 与factoryBean
beanFactory:基础核心接口,通过反射机制获取bean。
factoryBean:
If you have complex initialization code that is better expressed in Java as opposed to a (potentially) verbose amount of XML, you can create your own FactoryBean, write the complex initialization inside that class, and then plug your custom FactoryBean into the container.
当xml配置pojo比较复杂时,以java中类的定义方法来定义bean对象,最后只需在xml中注册即可。通过该方法获取的bean实际上是该bean的getObject()方法获取的对自身引用。
写博客这方面,转载是不可能转载的,这辈子都不可能转载,直接抄又没有脸去抄,只有自己随便划拉两笔,才能维持得了生活这样子。

浙公网安备 33010602011771号