基于J2EE平台的轻量级框架的应用研究
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着Java开源运动的不断发展,从数据持久层到业务逻辑层再到表示层都涌现出一批优秀的轻量级框架,从而极大地推动了J2EE技术的发展。传统的以EJB为核心的J2EE架构由于引入了不必要的复杂性,导致应用程序过于复杂、开发效率低、难于测试、维护成本高。在这种情况下,轻量级框架能够使企业级Web应用实现组件式开发、提高重用性、易于修改和维护、更好地解决项目开发中的开发周期问题以及需求变更问题,从而使企业资源得到最大化的利用,提出更有利于企业提高利润的解决方案。
     本文探讨了J2EE框架和轻量级框架技术的发展,对轻量级开发的核心机制控制反转和面向方面编程进行了剖析,针对表示层、业务层和持久层的实现提出了基于Struts2+Spring+Hibernate的轻量级解决方案。其中,Struts2是一个致力于组件化和代码重用的拉出式MVC模式实现框架,以其灵活、强大的功能为Web应用的构建减轻了负担。Spring是一个基于IoC的轻量级容器,区别于EJB的强侵入式,Spring的依赖注入动态的使系统各组件间达到松散耦合,并且能和各种框架很好的兼容。Hibernate是一个基于O/R映射的持久层框架,全面减轻了维护数据的复杂度,使系统具有良好的性能和移植性。
     本文以作者参与的某电视台办公自动化信息系统为背景,在对其进行全面需求分析的基础上,分别对Web层、业务逻辑层、数据持久层进行了详细设计。针对项目特点,在对比了各种框架技术的优势后,整合Struts2、Spring、Hibernate三种框架技术,提出了一个具有通用模式的轻量级架构:Struts2实现MVC模式并完成Web表示层功能,其业务逻辑交由Spring来管理;Spring负责管理表现层控制器与数据访问对象间关系,完成业务逻辑层功能;Hibernate负责数据的持久化工作。
     综上所述,本文在对各种主流框架技术深入分析的基础上,提出了集成Struts2、Spring、Hibernate三种框架技术的轻量级架构,不但能够有效地解决传统Web应用开发中存在的问题,而且采用分层及模块化设计使系统具有很高的可维护性、扩展性、移植性和组件的复用性。
Amounts of excellent Lightweight OpenSource frameworks on data persistence layer,business layer and presentation layer emerged with the development of the Java OpenSource movement,which greatly promoted the technology of J2EE.The traditional J2EE framework whose core point is EJB introduce certain unnecessary complexity,which result in the programs excessively complex,low efficiency of developing,testing difficultly and high cost of maintenance.In this situation, lightweight frameworks can help company to realize component development, increase reuse,be easy to modify and maintenance,it can also resolve the question of development cycle and requirement changing in the development better,maximize the utilization rate of the resource of enterprises,and put in resolvable plan which is favorable to increase the interests of the company.
     This paper inquiried into the J2EE and the lightweight framework at first,then analyses to the core technology of lightweight development AOP and Ioc.This text mainly put forward a lightweight solution by integrating Struts2,Spring and Hibernate,aiming at the realization of web layer,business logic layer and data persistence layer.Strnts2 is a pull-out framework of implementing MVC pattern and strives for reusing module and code,it relieves burden for constructing Web application by its flexible and powerful function.Differentiating strong invasion of EJB,Spring which is a lightweight container based inversion of control is designed with dependency injection and can make component loose coupling dynamically and compatible with other framework.Hibernate is a persistence framework based on object-relation mapping;which entirely reduces the complexity of maintaining data and make system have higher performance and portable.
     This paper takes the project of office automation system of a television station as example.To detailed design for each layer such as web layer,business logic layer and data persistence layer based on requirements analysis completely.As for the characteristic of project,after compared advantages of all sorts of framework technologies,the author integrated with Struts2,Spring and Hibernate and put forward a general model of lightweight architecture,what is that Struts2 which implemented MVC pattern play the role of Web presentation layer and hand over its business logic to Spring,manage objects' relation of between controller and data access object through Spring and make data persistence by Hibernate.
     In conclusion,this thesis made did deep analysis of many popular frameworks and offer a lightweight architecture of integrating Sruts2,Spring and Hibernate, which not only resolve traditional issues in Web design but also enhance the system's maintainability,expansibility,compatibility and reusability through adopting delamination and modularization.
引文
[1]Len Bass,Paul Clements,and Pick kazman.Software Architecture in practice[M].Addison-Wesley.2003.04.
    [2]马良,吕长雷.统一软件开发过程分析.微机发展,2004(14),36-37
    [3]Bot,K.Kalaichelvan,R.Kazman.An Approach to Software Architecture Analysis for Evolution and Reusability.Proceedings of CASCON'97.1997.12
    [4]Calma Mclure.软件复用技术在系统开发过程中考虑复用.机械工业出版社,2003.2
    [5]Mark Eagle.Wiring your web application with open source Java[EB/OL].http:/www.onjava.com/pub/a/onjava/2004/04/07/wiringwebapps.html,2004.4
    [6]Joseph J Bambara,Paul R Allen.J2EE技术内幕[M].机械工业出版社,2002.6
    [7]Johnson,Rod.J2EE development frameworks.Computer,v38,n1,January,2005,p107-110
    [8]Hammouda I,Koskimies K.A pattern-based J2EE application development environment.Nordic Journal of Computing vol.9,no.3:248-60,Fall 2002
    [9]Dai Lin,Wang RM.Design and implementation of project management system based on J2EE.Proceedings of 2005 international confence on management science and engineering:183-187,2005
    [10]王幸福.基于Spring和Struts的轻量级J2EE通用框架的研究与应用[D].武汉理工大学,2007.5
    [11]王卫平,王松涛,王名茗.一种基于J2EE、Spring和Hibernate的轻量级EAI构架.计算机系统应用,2005.11,38-41
    [12]施伟,张忠能.轻量级容器的设计与应用.计算机工程,2006.10(32),65-66
    [13]Craig Walls,Ryan Breidenbach.Spring in Action,Manning Publications,2005.7
    [14]袁华强,王亚强,朱君.利用J2EE轻量级框架构建Web应用研究.计算机工程与设计,2007.1(28),22-24
    [15]王海蓉.轻量级框架在企业级Web开发中的应用研究[D].成都理工大学,2007.6
    [16]Rod Johnson.Expert One-on-One J2EE Development Without EJB.Wrox,2004.7
    [17]Mike O'Docherty.Object-Oriented Analysis & Design Understanding System Development with UML2.0[M].Beijing:TingHua University Press,2006
    [18]Mark Priestley.Practical Object-Oriented Design with UML.Beijing:Tsinghua University Press,2000.11
    [19]王春支,唐俊武.关于IoC模式及轻量级容器的研究.湖北工业大学学报,2006.21(4),52-55
    [20]Chiba Shigeru,Ishikawa Rei.Aspect-oriented programming beyond dependency injection.Lecture Notes in Computer Science,v3586,ECOOP 2005-Object-Oriented Programming:19th European Conference.Proceedings,2005,p121-143
    [21]Zywno M,Sakowicz B,Wojciechowski,Zalewski P,Napieralski A.Usage of aspect oriented programming in J2EE applications.Proceedings of the 12th International Conference Mixed Design of Integrated Circuits and Systems.MIXDES 2005:4pp
    [22]翟向梅.基于Spring框架的楼盘推介管理系统的研究与设计[D].武汉理工大学,2006.4
    [23]Martin Fowler.Reducing Coupling[EB/OL].http://www.martinfowler.com/ieeeSoftware/coupling.pdf.2001
    [24]刘君强,顾海金,王讯.基于开源框架的高质量J2EE应用架构.计算机工程与设计,2007.28(1),16-18
    [25]罗时飞.精通Spring.北京:电子工业出版社,2005
    [26]吴高峰.基于Struts+Spring+iBatis的轻量级J2EE开发.Matrix与Java共舞,2005
    [27]林信良.Spring技术手册.北京:电子工业出版社,2006
    [28]Arthur John,Azadegan Shiva.Spring framework for rapid open source J2EE web application development:A case study.Workshop on Self-Assembling Wireless Networks,SNPD/SAWN 2005,p90-95
    [29]古全友,王恩波,晋昌胜.AOP技术在J2EE系统构建中的应用.计算机技术与发展,2006.16(4),150-152
    [30]孙中轶,何牧,蔡鸿明.应用AOP设计的可动态重构工作流引擎架构,计算机工程,2007.33(6),62-64
    [31]陈景燕,阳国贵.AOP下的权限控制实现.计算机与信息技术,2006.6,48-50
    [32]梁琳,许向众,洪超.Spring框架与AOP思想的研究与应用.计算机与信息技术,2006(4),24-26
    [33]袁绪峰.基与Spring框架的AOP编程.计算机与现代化,2006.1,118-120
    [34]阎宏.Java与设计模式.北京:电子工业出版社,2002.10
    [35]刘瑜,王立福,张世现.软件框架开发过程研究.计算机工程与应用,2004.2,26-30
    [36]华涛,郝克刚,葛玮.基于Hibernate和Spring框架的Web应用研究.计算机技术与发展,2006.16(11),84-86
    [37]丁杰,李治柱,陆舟.利用Spring框架进行WebWork与Hibernate的整合与开发.微型电脑应用,2006.2(22),30-35
    [38]高昂,卫文学.基于Hibernate与Struts框架的数据持久化应用研究.计算机应用,2005.12(25),2817-2820
    [39]赵克华,陈江,陈启华.基于Struts和Hibernate架构的MIS系统的构建计算机与数字工程.2006.6(34),110-112
    [40]孙卫琴.精通Hibernate.电子工业出版社.2005
    [41]刘博.基于J2EE轻量级框架的构建及应用[D].北京邮电大学,2007.3
    [42]薛四新,贾郭军主编.软件项日管理.北京:机械工业出版社,2004.5

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700