- 博客(25)
- 资源 (15)
- 收藏
- 关注
原创 使用Spring(16)使用TransactionTemplate进行Spring编程式事务管理
TransactionTemplate 采用与Spring中别的 模板 同样的方法,如 JdbcTemplate 和 HibernateTemplate。它使用回调机制,将应用代码从样板式的资源获取和释放代码中解放出来,不再有大量的try/catch/finally/try/catch代码块。同样,和别的模板类一样,TransactionTemplate 类的实例是线程安全的。必须
2016-10-25 21:31:40 1177
转载 Spring TransactionDefinition接口
http://www.cnblogs.com/fengchaowang/p/4122579.html16.2.1 探索TransactionDefinition接口正如之前所说的,TransactionDefinition接口控制着事务的属性。下面让我们进一步看看该接口及其方法,如代码清单16-1所示:代码清单16-1 TransactionDefinition接口
2016-10-24 22:36:42 5533 1
原创 使用Spring(15) Spring AOP APIs(NameMatchMethodPointcutAdvisor,RegexpMethodPointcutAdvisor))
1.applicationContext.xmlNameMatchMethodPointcutAdvisor<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.s
2016-10-24 13:05:13 1581
原创 使用Spring(14)Spring AOP APIs(AfterReturningAdvice,MethodInterceptor,MethodBeforeAdvice)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:sche
2016-10-24 08:57:59 510
原创 使用Spring(13)Spring与MyBatis整合(二)DataSourceTransactionManage把事务控制在Service层
1.jar包2.层次结构3.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.spr
2016-10-22 13:26:01 8923
原创 使用Spring(12)Spring与MyBatis整合(一)简单整合
1.jar包2.beans.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:c
2016-10-22 13:14:30 324
原创 使用Spring(11)使用Spring进行面向切面编程(AOP)Schema-based AOP support
使用XML格式官方说明:在Spring的配置文件中,所有的切面和通知器都必须定义在 元素内部。 一个application context可以包含多个。 一个 可以包含pointcut,advisor和aspect元素(注意它们必须按照这样的顺序进行声明)。风格的配置使得对Spring auto-proxying 机制的使用变得很笨重。如果你已经通过BeanNameAu
2016-10-21 12:56:19 323
原创 使用Spring(十)使用Spring进行面向切面编程(AOP)@AspectJ支持
AOP概念官方说明:Spring使用自己的术语。 切面(Aspect): 一个关注点的模块化,这个关注点可能会横切多个对象。事务管理是J2EE应用中一个关于横切关注点的很好的例子。 在Spring AOP中,切面可以使用通用类(基于模式的风格) 或者在普通类中以@Aspect 注解(@AspectJ风格)来实现。连接点(Joinpoint): 在程序执行过程
2016-10-20 21:08:16 560
原创 使用Spring(九)自动装配(autowire)协作者
Spring官方:Spring IoC容器可以自动装配(autowire)相互协作bean之间的关联关系可以自动让Spring通过检查BeanFactory中的内容,来替我们指定bean的协作者(其他被依赖的bean)。由于autowire可以针对单个bean进行设置,因此可以让有些bean使用autowire,有些bean不采用。autowire的方便之处在减少或者消除属性或构造器参数的
2016-10-20 20:55:01 468
原创 使用Spring(八) 延迟初始化bean、Lookup方法注入
1.applicationContext4.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.o
2016-10-19 19:12:13 2025
原创 使用Spring(七)集合合并、bean的作用域(prototype,singleton)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/
2016-10-19 18:46:47 536
原创 使用Spring(六)集合
1.applicationContext2.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema
2016-10-18 21:40:42 269
原创 使用Spring(五) 引用其它的bean(协作者)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/
2016-10-18 21:23:09 322
原创 使用Spring(四)构造器参数匹配(类型匹配 ,索引)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/sch
2016-10-18 16:14:48 703
原创 使用Spring(三)依赖注入DI(Setter DI,构造器注入)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/sch
2016-10-18 13:11:50 414
原创 使用Spring(二)实例化方式(静态工厂,实例工厂)
1.applicationContext.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/sch
2016-10-18 13:00:12 882
原创 使用Spring(一)实例化容器方法(3种方法)
1.applicationContext2.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/sche
2016-10-17 23:12:46 434
原创 代理模式--静态代理和动态代理
代理模式是java常用的设计模式,他的特征是代理类与委托类有同样的接口,代理类主要负责为委托类预处理消息、过滤消息、把消息转发给委托类,以及事后处理消息等。代理类与委托类之间通常会存在关联关系,一个代理类的对象与一个委托类的对象关联,代理类的对象本身并不真正实现服务,而是通过调用委托类的对象的相关方法,来提供特定的服务。类似生活中代理的含义。按照代理的创建时期,代理类可以分为两种。 静
2016-10-17 22:01:08 293
原创 Spring MVC(七)基于注解的文件上传
a.web.xml<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocatio
2016-10-07 22:46:49 515
原创 Spring MVC(六)基于注解MVC(@Controller @RequestMapping)
a.package com.yw.controller;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;@Controllerpublic class TestController{ @RequestMappi
2016-10-07 18:17:42 372
原创 Spring MVC(五)封装表单参数的控制器(FormController)
a.新建一个表单控制器EmpFormController继承extends SimpleFormController,并实现onSubmit方法表单控制器的流程较复杂和前面命令控制器的区别是表单控制器里面的onSubmit方法需要有Post方式提交才能执行到,Get方法不行//可以处理表单流程public class EmpFormController extends
2016-10-06 16:32:28 767
原创 Spring MVC(四)封装表单参数的控制器(AbstractCommandController)
SpringMVC 也可以根据模型来匹配CommandControllerAbstractCommandController在spring3中已经过期,原因是鼓励你用注解package com.yw.controller;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpS
2016-10-03 18:13:16 1273
原创 Spring MVC(三)封装表单参数的控制器(AbstractController)
a.建立员工javabeanpackage com.yw.controller;public class Emp{ private String name; private int phone;}b.创建添加员工的页面form表单 add_emp.jsp name: phone:
2016-10-03 17:00:24 1561
mybatis-spring v2.0.CHM
2016-10-26
Jsp+Servlet+MyBatis完成分页查询
2016-06-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人