Spring的事务管理:
PlatformTransactionManager 事务管理器
TransactionStatus 事务状态
TransactionDefinition 事务详情
传播行为:7个
PROPAGATION_REQUIRED
PROPAGATION_SUPPORTS
隔离级别
ISOLATION_READ_UNCOMMITTED
ISOLATION_READ_COMMITTED
ISOLATION_REPEATABLE_READ
ISOLATION_SERIALIZABLE
默认超时时间 -1
目标类: service
切面类: DataSourceTransactionManager(jdbc)
spring实现了AOP,所以实现了事务管理
1.半自动方式 ProxyFacotryBean编程式事务
TransactionProxyFactoryBean
接口
切面类对象
目标类对象
配置详情
2.全自动方式 aop:config AOP联盟,AspectJ
<tx:advice></tx:advice>
<aop:config> </aop:config>
3.注解: Transactional(propagation=Propagation.,isolation=Isolation.) 声明式事务
Spring整合Junit
@RunWith(SpringJunit4ClassRunner.class)
@ContextConfiguration(locations=,classes=)
IOC,DI,AOP,事务管理
SpringMVC:Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面。
Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。使用 Spring 可插入的 MVC 架构,
从而在使用Spring进行WEB开发时,可以选择使用Spring的Spring MVC框架或集成其他MVC开发框架,
Spring MVC是一个基于Java的实现了MVC设计模式的请求驱动类型的轻量级Web框架,
通过把Model,View,Controller分离,将web层进行职责解耦,
把复杂的web应用分成逻辑清晰的几部分,简化开发,减少出错,方便组内开发人员之间的配合
springmvc的入门程序:
依赖:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
非注解情况下:
BeanNameUrlHandlerMapping 处理器映射器
SimpleControllerHandlerAdapter 处理器适配器
注解情况下: @Controller @RequestMapping
RequestMappingHandlerMapping 处理器映射器
RequestMappingHandlerAdapter 处理器适配器
`<mvc:annotation-driven></mvc:annotation-driven>`
这个配置可以替代
RequestMappingHandlerMapping
RequestMappingHandlerAdapter
springmvc的执行流程
参数封装:
简单数据类型,框架做了类型转换
框架默认处理的日期格式是 yyyy/MM/dd
自定义类型转换器: Converter
配置:
<!--配置自定义的类型转换器-->