![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring学习笔记
easylife_el
这个作者很懒,什么都没留下…
展开
-
Bean的生命周期
一个Bean从建立到销毁,会经历几个阶段,如果使用BeanFactory或ApplicationContext来生成、管理Bean,会尽量支持以下的生命周期: 1、Bean的建立 由BeanFactory读取Bean定义文件,并生成Bean的实例。 2、属性注入 执行相关的Bean配置依赖注入。 3、BeanNameAware的set...2007-11-06 08:37:13 · 80 阅读 · 0 评论 -
AOP实现(一)——Advice
在Spring1.2或之前的版本中,实现AOP的传统方式就是通过实现Spring的AOP API来定义Advice,并设置代理对象。Spring根据Adivce加入到业务流程的时机的不同,提供了四种不同的Advice:Before Advice、After Advice、Around Advice、Throw Advice。1、Before Advice顾名思义,Before Advice会在...2007-11-11 00:36:00 · 111 阅读 · 0 评论 -
AOP实现(二)——Spring 2.0中的AOP实现
在Spring 2.0中,除了传统的通过实现AOP AIP的方式来实现Advice之外,还提供了两种更加简便的方式来实现Advice:1)基于XML Schema的设置;2)基于Annotation的支持,采用这两种方式,Advice将不用实现特定的接口。现在让我们来看看如何使用这两种方式来分别实现Before Advice、After Advice、Around Advice、Throw...2007-11-16 08:02:55 · 89 阅读 · 0 评论 -
AOP实现(三)——Spring 2.0中Pointcut的定义
在Spring 2.0中,Pointcut的定义包括两个部分:Pointcut表示式(expression)和Pointcut签名(signature)。让我们先看看execution表示式的格式:java 代码 execution(modifier-pattern? ret-type-pattern decla...2007-11-17 11:04:28 · 441 阅读 · 0 评论 -
Spring的最佳入门手册:Spring in action
对于Spring的初学者来说,《Spring in action》是我看过的Spring书籍中最好的一本,虽然我看的是英文版,但这也是我看过的英文书中最容易看的一本,句子都十分简单,只要稍微有些英文底子就可以看懂它,不象其它英文书那样,有时一句话要看上几遍才能看明白它在讲什么,至于内容上也非常丰富,各个章节的内容写的也很细腻,入门时看《Spring in action》要比看《Spring专业开发...2008-01-13 09:02:16 · 135 阅读 · 0 评论 -
ApplicationContext的初始化
以ClassPathXmlApplicationContext初始化一个ApplicationContext对象时,只需要在构造方法中指定好定义文件在classpath中的路径即可,如: ApplicationContext context = new ClassPathXmlApplicationContext( ...2008-01-25 00:18:33 · 661 阅读 · 0 评论 -
Bean基本管理的小细节
Spring使用BeanFactory、ApplicationContext来管理bean的生命周期,有如下特点: 1)默认情况下,定义文件中的bean都是Singleton的,即每次通过getBean()方法返回的对象都是同一个对象,可以通过Bean的scope指定为prototype、或者将singleton指定为false, 使得每次调用getBean()方法时都产生一个新对象,如: <...2008-01-25 00:31:50 · 63 阅读 · 0 评论 -
JDBC的支持——DataSource的配置
Spring中DataSource的注入方法: 1) 在进行单元测试或应用系统比较小时,可以使用Spring的DriverManagerDataSource:<bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource"><property name="driverClassN...2008-02-28 23:00:48 · 605 阅读 · 0 评论