go4it

just do it

上一页 1 2 3 4 5 6 7 8 ··· 25 下一页

2009年7月20日

Spring视频学习(二)实例化bean的3种方法

摘要: 1.实例化bean的三种方法: (1) 构造器<bean id="personService" class="com.persia.PersonServiceBean"> <constructor-arg index="0" value="构造注入的name" ></constructor-arg> <!-- 基本类型可以不写type --> <... 阅读全文

posted @ 2009-07-20 13:02 cxccbv 阅读(661) 评论(0) 推荐(0)

Spring视频学习(一)依赖注入原理

摘要: 1. 控制反转 依赖对象的创建和维护由应用本身转移到外部容器,即控制权也转移到外部容器中。 2. 依赖注入 依赖对象有外部容器在运行期间动态注入到组件中。 3.所需要的jar包: 4.核心版的spring (1)spring配置文件放在类路径src下 模板:<?xml version="1.0" encoding="UTF-8"?><beansxmlns="http://www.... 阅读全文

posted @ 2009-07-20 10:36 cxccbv 阅读(573) 评论(0) 推荐(0)

2009年7月17日

Spring JPetStore学习(二)业务层

摘要: applicationContext如下:<?xml version="1.0" encoding="UTF-8"?><!-- - Application context definition for JPetStore's business layer. - Contains bean references to the transaction manager and to... 阅读全文

posted @ 2009-07-17 15:37 cxccbv 阅读(1272) 评论(0) 推荐(0)

Spring JPetStore学习(三)事务

摘要: spring配置文件application.xml中的事务总结 http://fluagen.blog.51cto.com/146595/148777 spring配置文件中几种配置事务的方式: 第一种:通过aop管理用户的增删改 (aspectJ) <aop:config> <aop:advisor pointcut="execution(* *..OrderDao.*(.... 阅读全文

posted @ 2009-07-17 14:32 cxccbv 阅读(1224) 评论(0) 推荐(0)

Spring JPetStore学习(一)配置JPetStore

摘要: http://quqtalk.javaeye.com/blog/362163 一、在Tomcat中部署Spring jpetstore Spring samples中的jpetstore,基于iBATIS的jpetstore,数据库层使用iBATIS。在web层,提供了两种MVC可以选择,即Spring的MVC和Struts的MVC(1.1)。 测试环境: JDK版本:1.5.0_12-b04... 阅读全文

posted @ 2009-07-17 11:31 cxccbv 阅读(7116) 评论(0) 推荐(0)

Spring学习(五)基于注解的配置

摘要: 基于注解(Annotation-based)的配置 在第 3.7.1.2 节 “RequiredAnnotationBeanPostProcessor示例”一节中我们提到了基于注解的配置方式,使用BeanPostProcessor与注解是 Spring IoC 容器的一个普通扩展方法。例如,Spring 2.0 对必须的属性引入了@Required注解。在 Spring 2.5中已经可以用注解的方... 阅读全文

posted @ 2009-07-17 10:59 cxccbv 阅读(1789) 评论(0) 推荐(1)

Spring学习(四)ApplicationContext

摘要: The ApplicationContext beans包提供了以编程的方式管理和操控bean的基本功能,而context包下的ApplicationContext以一种更加面向框架的方式增强了BeanFactory的功能。多数用户可以采用声明的方式来使用ApplicationContext,甚至不用手动创建它,而通过ContextLoader这样的支持类,把它作为J2EE web应用的一部分自动... 阅读全文

posted @ 2009-07-17 10:55 cxccbv 阅读(1058) 评论(0) 推荐(0)

Spring学习(三)生命周期回调

摘要: 生命周期回调 Spring提供了几个标志接口(marker interface),这些接口用来改变容器中bean的行为;它们包括InitializingBean和DisposableBean。实现这两个接口的bean在初始化和析构时容器会调用前者的afterPropertiesSet()方法,以及后者的destroy()方法。 Spring在内部使用BeanPostProcessor实现来处理它... 阅读全文

posted @ 2009-07-17 10:48 cxccbv 阅读(1172) 评论(0) 推荐(0)

Spring学习(二)bean的作用域

摘要: Bean的作用域 创建一个bean定义,其实质是用该bean定义对应的类来创建真正实例的“配方(recipe)”。把bean定义看成一个配方很有意义,它与class很类似,只根据一张“处方”就可以创建多个实例。 你不仅可以控制注入到对象中的各种依赖和配置值,还可以控制该对象的作用域。这样你可以灵活选择所建对象的作用域,而不必在Java Class级定义作用域。Spring Framework支持五... 阅读全文

posted @ 2009-07-17 10:44 cxccbv 阅读(1451) 评论(1) 推荐(1)

Spring学习(一)依赖注入

摘要: from Spring Framework开发手册参考(redsaga) 注入依赖 依赖注入(DI)背后的基本原理是对象之间的依赖关系(即一起工作的其它对象)只会通过以下几种方式来实现:构造器的参数、工厂方法的参数,或给由构造函数或者工厂方法创建的对象设置属性。因此,容器的工作就是创建bean时注入那些依赖关系。相对于由bean自己来控制其实例化、直接在构造器中指定依赖关系或者类似服务定位器(S... 阅读全文

posted @ 2009-07-17 10:28 cxccbv 阅读(2191) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 25 下一页

导航