代码实现
1. 对象
hibernate有@Table,并 implements Serializable;
mybaties 无注解,无继承、实现。
2.Dao 层
hibernate 使用dao接口 , 有sql 注解。
mybaties dao接口,需要Mapper.xml 。
3. Service
spring 有service接口,并在serviceImp上@Service/@Transactional。
spring 没有service接口,并在serviceImp上@Service/@Transactional。
4. 表现层
struts2 的action , spring管理多例。
springMVC 的controller基于方法的注解 @Controller,每个方法上@RequestMapping
底层实现
其次,SpringMVC的拦截粒度是方法,而Struts的粒度是类
然后,入口不同,SpringMVC的入口是servlet,而Struts是filter
最后,如果使用注解的话,SpringMVC基本上是零配置,而Struts需要配置很多。
springMVC
struts