spring_in_action_source

所属分类:Java编程
开发工具:Java
文件大小:5605KB
下载次数:26
上传日期:2007-01-23 11:59:48
上 传 者木头_毛毛
说明:  spring in action 源代码
(spring action in the source code)

文件列表:
spring_in_action_source\SpringTraining\.classpath (353, 2004-10-10)
spring_in_action_source\SpringTraining\.project (588, 2004-06-17)
spring_in_action_source\SpringTraining\.springBeansProject (274, 2004-06-17)
spring_in_action_source\SpringTraining\acegi-security.jar (242613, 2005-01-25)
spring_in_action_source\SpringTraining\babelFish.xml (1150, 2004-08-31)
spring_in_action_source\SpringTraining\build-example.properties (508, 2004-08-20)
spring_in_action_source\SpringTraining\build.properties (1138, 2006-12-04)
spring_in_action_source\SpringTraining\build.xml (8390, 2005-01-31)
spring_in_action_source\SpringTraining\config\hibernate.properties (205, 2005-01-25)
spring_in_action_source\SpringTraining\config\log4j.properties (695, 2005-02-02)
spring_in_action_source\SpringTraining\lib\acegi-security-taglib.jar (5793, 2005-01-25)
spring_in_action_source\SpringTraining\lib\acegi-security.jar (242613, 2005-02-02)
spring_in_action_source\SpringTraining\lib\aopalliance.jar (4467, 2004-06-17)
spring_in_action_source\SpringTraining\lib\commons-codec-1.2.jar (29029, 2004-12-09)
spring_in_action_source\SpringTraining\lib\hsqldb.jar (577168, 2005-01-25)
spring_in_action_source\SpringTraining\lib\jms.jar (25998, 2004-08-19)
spring_in_action_source\SpringTraining\lib\jstl.jar (20682, 2004-10-25)
spring_in_action_source\SpringTraining\lib\jta.jar (8674, 2004-06-17)
spring_in_action_source\SpringTraining\lib\oro-2.0.8.jar (65261, 2004-09-21)
spring_in_action_source\SpringTraining\lib\quartz.jar (319645, 2004-08-19)
spring_in_action_source\SpringTraining\lib\spring.jar (1272901, 2004-08-19)
spring_in_action_source\SpringTraining\lib\standard.jar (393259, 2004-10-25)
spring_in_action_source\SpringTraining\lib\struts-1.1.jar (498051, 2004-08-19)
spring_in_action_source\SpringTraining\lib\tapestry-3.0.jar (740442, 2004-08-19)
spring_in_action_source\SpringTraining\setup.sql (163, 2005-02-02)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\babelfish\BabelFishClient.java (535, 2004-08-31)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\babelfish\BabelFishRemote.java (252, 2004-08-31)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\babelfish\BabelFishService.java (154, 2004-08-31)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\payment\AuthorizationException.java (97, 2004-08-26)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\payment\PaymentService.java (358, 2004-08-26)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\payment\PaymentServiceImpl.java (1094, 2004-08-26)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\payment\SettlementException.java (94, 2004-08-26)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\tapestry\SpringTapestryEngine.java (971, 2004-08-18)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\CourseException.java (190, 2004-06-17)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\dao\CourseDao.java (279, 2005-01-25)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\dao\CourseDaoImpl.java (749, 2005-02-01)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\dao\hibernate\InstructorDaoHibernate.java (1140, 2005-01-27)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\dao\hibernate\StudentDaoHibernate.java (1355, 2005-01-31)
spring_in_action_source\SpringTraining\src\java\main\com\springinaction\training\dao\InstructorDao.java (406, 2005-01-27)
... ...

This is the Spring Training application used as a demo for "Spring in Action". To get started, you must edit build.properties, configuring the build for your particular environment. This includes specifying the location of a Spring installation on your system, database specifics, logging paths, and the path where the build should a WAR file for deployment. Once build.properties is configured, you are ready to setup your database. We are using Hypersonic for the database, but you may swap it out with a database installation of your choosing (such as Oracle, MySQL, etc) by changing the database configuration properties in build.properties. If you choose to use Hypersonic, the only database configuration you *must* change is hsql.path. Point this to a directory on your machine where you want the Hypersonic database to physically reside. To start Hypersonic, run the "hsql" target of the build: % ant hsql & or > start ant hsql This target will block once the database is started, so we recommend that you run it in the background ('&' in Unix) or in a separate window ("start" in Windows). With the database running, you next must create the tables for the Spring Training application. The "setup_db" target of the Ant build will handle this for you: % ant setup_db The "setup_db" target starts by using XDoclet to generate the Hibernate mapping files, then uses those mapping files and Hibernate's schemaexport task to generate the tables. It also inserts some test data into the database. If you'd prefer to only generate the database, but not insert the test data, use the "schema" target instead. The database is started and the tables are created. The last thing to do is to deploy the application itself. Run the "deploy" target of the Ant build: % ant deploy Upon completion, the SpringTraining.war file will have been placed in the deployment directory specified by the deploy.target build property. Start your application server (or otherwise deploy the WAR file) and point your browser to: http://localhost:8080/SpringTraining (Note: The actual URL of the application may vary depending on your hostname and application server port.) Several functions of the Spring Training application are restricted to logged in users with certain privileges. Creating a new course or adding a new instructor, for instance, both require that you be logged in with ROLE_INSTRUCTOR privileges. This creates a chicken and egg problem where you must log in as an instructor to create an instructor user to log in as. Fortunately, part of the "setup_db" target adds a super user to the database that can access all areas of the application. Login to Spring Training with "admin" as both the username and the password and you'll be able to do almost anything (including creating an instructor user). CONCERNING THE SOURCE CODE... Although we tried to keep the source code for the Spring Training application as close to the example code in Spring in Action as possible, you may have noticed some minor (and maybe even some major) differences. The fact is, that we wrote the examples in the book's text while our focus was on producing a printed book. That means that while the examples in the book should be technically correct and should highlight the concepts being expressed, they may not reflect the best approach to take when actually coding the Spring Training application. Throughout the course of writing the book, we learned more and better ways of coding Spring applications. This left us with the choice of leaving the Spring Training application alone and letting it match the book's code verbatim or to update the application to reflect the latest knowledge available. It is impossible to change the examples in the book once the book has been sent to the printers. However, we have the freedom to keep the Spring Training application updated based on current knowledge. Therefore, we chose to change and refactor the Spring Training application to take into account our new learning. In doing so, however, we strove to keep the spirit of the code in line with the code examples in the book. There is no doubt that as time goes on we'll learn and discover even better ways to implement the Spring Training application. When (not if) that happens, don't be surprised if we make further changes to the Spring Training application.

近期下载者

相关文件


收藏者