`
wutao8818
  • 浏览: 612734 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

重头开始学 Spring JPetStore 1

阅读更多
先看看它的readme.txt

引用
@author Juergen Hoeller
Based on Clinton Begin's JPetStore (http://www.ibatis.com).

1. MOTIVATION
Features a Spring-managed middle tier with iBATIS Database Layer as data access
strategy, in combination with Spring's transaction and DAO abstractions.

Can work with local JDBC transactions or JTA, with the latter on two databases.
Uses the same data model and demo contents as the original JPetStore.
See the context definitions "WEB-INF/dataAccessContext-local.xml" respectively
"WEB-INF/dataAccessContext-jta.xml" for details.

Offers two alternative web tier implementations with the same user interface:
one based on Spring's web MVC, and one based on Struts 1.1. The latter is close
to the original JPetStore but reworked for JSTL, to make the JSP implementations
as comparable as possible. See "WEB-INF/web.xml", "WEB-INF/petstore-servlet.xml",
and "WEB-INF/struts-config.xml" for details.

Compared to the original JPetStore, this implementation is significantly
improved in terms of internal structure and loose coupling: Leveraging Spring's
application context concept, there's a central place for wiring application
objects now. The most notable improvement is the former PetStoreLogic, now
called PetStoreFacade: It is no longer concerned with configuration, resource,
or transaction details.
Note that the Spring-based web tier implementation is deliberately similar to
the Struts-based one and does not aim to improve in terms of in-place error
messages or the like. The inclusion of two web tier alternatives outlines the
differences as well as the similarities in the respective programming model,
and also illustrates the different configuration styles.
This version of JPetStore also demonstrates various remoting options with Spring:
Hessian, Burlap, RMI, and Web Services via Apache Axis. They are all provided
out-of-the-box by the default web application (note that RMI is commented out
to avoid conflicts with EJB containers). The "client" directory contains a simple
command-line client that invokes the exported OrderService via all protocols.


动机

演示一个基于spring中间层 数据库层访问策略为ibatis 并组合spring事务及DAO抽象的情景。
能结合JDBC事务或者JTA工作(与后面的两个数据库的情景中。)

使用了与原始JPetStore相似的数据模型和演示内容。具体上下文定义查看2个配置文件。

为相似的用户接口提供了两种web层实现,一个是基于springmvc的实现。一个是基于struts1.1的实现,后面一个接近原始的JPetStore,但是用JSTL标签重写了,以便JSP实现更具有可比性。了解细节查看3个配置文件。

和原始的JPetStore相比较,这个实现显著的提高了内部结构和松耦合:利用Spring的应用程序上下文原则,这里现在是建立对象之间联系的中心了。最值得注意的改进是从前的PetStoreLogic,现在称为PetStoreFacade,它不再关注配置资源和事务细节。

注意基于spring的web层实现故意与基于struts的实现很像并且没有关注改进适当位置的错误消息提示等等。这展示了2个web层的不同和相同点,同时还展示了不同的配置风格。

这个版本的JPetStore 也展示了Spring支持的多种远程调用方法:Hessian, Burlap, RMI, and Web Services via Apache Axis.他们都被用于提供web程序外部调用(注意 RMI 调用被注释掉了来以防与EJB容器冲突)。client目录包含了简单的命令行客户端以各种协议 调用暴露出来的OrderService 方法。
分享到:
评论

相关推荐

    学习Spring 的例子JpetStore

    《Spring框架学习:以JpetStore为例》 Spring框架是Java企业级应用开发中的核心框架,它为开发者提供了丰富的功能,简化了开发流程,提高了代码的可测试性和可维护性。JpetStore作为Spring的经典示例项目,是学习...

    spring例子: jpetstore

    标题 "spring例子: jpetstore" 提到的是一个基于Spring框架的应用示例——JPetStore。这个项目是Spring官方提供的一个经典示例,用于展示如何使用Spring框架来构建Web应用程序。它是一个小型的在线宠物商店,包含了...

    spring jpetstore spring附带的例子

    1. Spring MVC:作为Spring框架的一部分,Spring MVC提供了一种用于构建Web应用程序的分层架构。在这个例子中,JPetStore展示了如何定义控制器、处理用户请求、绑定数据到模型以及渲染视图。Spring MVC通过...

    spring jpetstore2.5

    《Spring JPetStore 2.5:MyEclipse下的实战指南》 在IT行业中,Spring框架作为Java企业级应用开发的主流选择,以其强大的功能和灵活性赢得了广大开发者喜爱。而JPetStore作为Spring官方提供的一个示例应用,是学习...

    Spring jpetstore

    **Spring jpetstore** 是一个基于Spring框架的开源示例应用,它展示了如何使用Spring MVC、Spring JDBC以及Spring的其他核心特性来构建一个完整的Web应用。这个项目是Spring官方提供的,旨在帮助开发者学习和理解...

    jpetstore4.0 (spring+struts+ibatis)

    《基于Spring、Struts和iBatis的jpetstore4.0详解》 jpetstore4.0是一款经典的电子商务示例应用,它采用Spring、Struts和iBatis这三个核心框架构建,展示了如何在Java环境下实现一个完整的MVC(Model-View-...

    jpetstore spring 的经典完整可直接运行的例子 jpetstore

    《基于jpetstore的Spring、iBatis与Struts整合实战》 jpetstore项目是Spring框架的一个经典示例,它全面展示了如何将Spring、iBatis和Struts这三个核心的Java Web技术进行集成,构建出一个完整的MVC(Model-View-...

    MyEclipse中加载Spring的JPetStore

    1. **项目导入**:首先,你需要下载JPetStore的源码压缩包,这在你提供的文件列表中已经包含,名为"JPetStore"。在MyEclipse中,选择“File” -> “Import” -> “Existing Projects into Workspace”,然后在弹出的...

    spring之jpetstore

    1. **Spring框架基础** Spring是一个开源的Java平台,它简化了开发过程,提供了依赖注入(DI)和面向切面编程(AOP)等核心特性。在JPetStore项目中,Spring通过配置文件管理对象的生命周期和相互依赖关系,使得...

    spring的jpetstore工程(myeclipse)

    《Spring的JPetStore工程与MyEclipse集成详解》 Spring框架是Java开发中的核心组件,它提供了丰富的功能,如依赖注入(DI)、面向切面编程(AOP)、数据访问和事务管理等。JPetStore作为Spring官方提供的一个示例...

    Spring+jpetstore+Myeclipse

    最新spring带的JPetStore的MyEclipse项目,包括了数据库,可用hsqldb直接运行,可以直接导入MyEclipse中并部署运行。 在Myeclipse里新建一个web项目,导入shopping项目即可,数据库在db文件夹里

    eclipse_spring_jpetstore.rar

    《Eclipse环境下的Spring框架——以JPetStore项目为例》 在Java开发领域,Eclipse作为一款强大的集成开发环境(IDE)被广泛使用,而Spring框架则是企业级应用开发的重要选择。本文将深入探讨如何在Eclipse环境中...

    Spring源码学习-JPetStore.part3

    spring自带的JPetStore,我已经配置好(数据库也配置好,用的是hsqldb),可以直接导 入eclipse中运行。共3个压缩包

    JPetStore (Struts + Spring + Hibernate)版

    **标题解析:** "JPetStore (Struts + Spring + Hibernate)版" 是一个基于Java技术的开源电子商务示例应用,它集成了Struts、Spring和Hibernate三个关键的开源框架。这个版本相较于之前的JPetStore5.0,进行了重要的...

    Struts+Spring+Hibernate实现的jpetstore

    1. **配置文件**:如struts-config.xml,spring的beans.xml,hibernate的hibernate.cfg.xml等,它们定义了各框架的配置和组件。 2. **实体类**:表示数据库表的Java类,通常包含对应的Hibernate注解。 3. **DAO接口...

    jpetstore开源学习代码

    1. **MVC模式**:模型-视图-控制器模式是J2EE开发中常见的设计模式,用于分离业务逻辑、用户界面和数据管理。在jpetstore中,模型处理业务逻辑,视图负责展示数据,而控制器接收用户请求并协调模型和视图之间的交互...

    jpetstore

    该jpetstore经典案例为最新SPRING开发包里面的完全案例,并集成到eclipse里面了,在eclipse里面可以直接运行并调试,在工作目录里面直接建立jpetstore目录,自动导入该目录下文件,修改jdbc.properties配置文件,连接...

    用jpetstore学习架构 使用Spring boot+MyBatis +MySQL.zip

    【标题】"用jpetstore学习架构 使用Spring boot+MyBatis +MySQL"是一个实践项目,旨在帮助开发者通过实现一个具体的电商应用——jpetstore,掌握基于Spring Boot、MyBatis和MySQL数据库的架构设计与开发技能。...

    jpetstore系统架构图

    尽管jpetstore5.0系统架构图未明确提及Spring框架,但Spring在企业级应用开发中起着举足轻重的作用。它提供的依赖注入(DI)和面向切面编程(AOP)功能,极大地提升了代码的灵活性和可维护性。在实际应用中,Spring...

Global site tag (gtag.js) - Google Analytics