
Spring
fzjiangmin1984
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Spring_001_初步配置
1、基础的xml配置文件:例如bean.xml配置文件,格式如下: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.spr原创 2012-12-02 22:40:01 · 266 阅读 · 0 评论 -
Spring_002_ 三种注入方式
Spring的三种注入方式 三种注入方式如下: 1、set注入(重要) beans.xml的配置文件如下 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaL原创 2012-12-03 21:45:05 · 245 阅读 · 0 评论 -
Spring_003_scope
bean的作用域scope常用到的范围有2个: singleton (单例):无论取多少个,都是同一个对象 prototype(原型):每次取的不是同一个对象原创 2012-12-03 22:54:03 · 233 阅读 · 0 评论 -
Spring_004_AutoWire(自动装配)
自动装配,官方给出的定义是这样: Spring IoC容器可以自动装配(autowire)相互协作bean之间的关联关系。因此,如果可能的话,可以自 动让Spring通过检查BeanFactory中的内容,来替我们指定bean的协作者(其他被依赖的bean)。由于 autowire可以针对单个bean进行设置,因此可以让有些bean使用autowire,有些bean不采用。autowire的原创 2012-12-03 23:13:29 · 222 阅读 · 0 评论 -
Spring_005_IOC_Annotation_Autowired_Qulifier
Annotation:采用注释的方式类进行DI注入 1、在beans.xml配置文件添加如下: 2、在xml-catalog中添加xsd配置文件 Location: E:\study\java\tools\spring\spring-framework-2.5.6-with-dependencies\spring-framework-2.5.6\dist\resources\sprin原创 2012-12-05 21:25:16 · 340 阅读 · 0 评论 -
Spring_006_IOC_Annotation_Resource_Component
Resource @Resource:用注释的方式注入 1、j2ee/common-annotations.jar 将包导入; 2、@Resource 引入(默认的方式是byName,在不写名字的时候,默认是按照取userDao); 3、@Resource(name="u1")(采用命名的方式引入) xml文件如下: <beans xmlns="http://www.springf原创 2012-12-07 22:19:25 · 271 阅读 · 0 评论 -
Spring_007_AOP_Annotation
在Spring中使用AOP的步骤如下: 1、首先在xml文件中添加如下配置: xmlns:aop="http://www.springframework.org/schema/aop" http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd原创 2012-12-13 22:28:49 · 315 阅读 · 0 评论 -
Spring_008_AOP_XML
使用XML方式来实现AOP(一般采取这种方式,而不采取注释的方式) beans.xml配置文件如下: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="h原创 2012-12-15 21:18:43 · 258 阅读 · 0 评论 -
Spring_009_DataSource
1、导入相关的包:commons-dbcp.jar、commons-pool.jar、oracle 的驱动包 beans.xml配置文件如下: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"原创 2012-12-16 11:33:01 · 281 阅读 · 0 评论