基于J2EE的轻量级架构开发方法及应用研究
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着J2EE技术大规模的应用,EJB技术受到广泛的质疑。EJB技术给J2EE应用开发带来了严重的复杂性和巨大的开销。降低J2EE的复杂性开始成为开发者的主要关注点。目前,在开源社区大量出现的开源框架为我们的轻量级架构开发方法研究提供了强大的支持。
     本文对比分析了传统J2EE架构和轻量级J2EE架构的优缺点,推荐采用轻量级基础架构而尽量避免使用EJB进行J2EE开发,对多层轻量级架构理论及框架结构进行了详细的研究,具体分析了Struts、Spring和Hibernate这三个代表性框架各自的特性。重点就轻量级容器的核心机制控制反转和面向方面编程展开了深入的探讨。
     本文以Spring框架为主要研究对象,具体研究了如何在容器管理、面向方面编程、事务管理、数据持久化、远程调用等方面用轻量级方案替代EJB,同时就如何将Struts、Spring和Hibernate等各层框架合理整合给出了具体的解决方案。轻量级容器启动快,可方便配置,能够管理任何粒度的对象,它借助控制反转,通过xml文件配置对象之间以及对象和轻量级容器的依赖关系,解决了组件装配的问题,使开发人员可以专心处理业务逻辑。同时轻量级方案通过面向方面编程(AOP)为Java普通对象提供声明性企业级服务,实现轻量级框架的无侵入性、灵活性和可扩展性。
     论文最后设计并实现出一个基于J2EE轻量级架构的网上购书系统。实验结果验证了框架整合的开发能力,提高了开发效率,增加了应用系统的可维护性,可扩展性和可移植性。
While the J2EE is widely employed in applications, there are a lot of questions on EJB. The EJB technique brings a lot of complexities and enormous expenses to the J2EE applications. Reducing the complexity of J2EE development has become the main concern. At present, many open-source frameworks which origin J2EE open source provide strong support for our lightweight development methodology framework.
     This thesis analyzes the advantages and disadvantages of the lightweight J2EE architecture by contrast with the traditional J2EE architecture. We are inclined to choose the lightweight framework and to avoid using EJB technique in J2EE Application. This thesis does a deep research on the multi-layer lightweight framework theory, makes a detailed study on the respective characteristics of three frameworks: Struts, Spring and Hibernate. It also makes a deep discussion on the core mechanism of lightweight container: IoC and AOP.
     This thesis focuses on the research of how to use Spring framework to replace EJB in container management, aspect-oriented programming, transaction management, remote invocation, data persistence and so on. we give a specific solution about how to exactly integrate Struts, Spring and Hibernate together. Lightweight containers start fast and light. It can be easily configured and manage any size of the object. Lightweight container uses IoC to resolve the assembly of component object, so developers can concentrate on business logic. Based on aspect-oriented programming, lightweight can provide enterprise-level services, achieve realization of no-instrusion, flexibility and scalability.
     Finally the thesis designs and realizes an online shopping books system based on the lightweight J2EE architecture. Experimental results validate the integration and development capabilities of the architecture and improve development efficiency, increase the maintainability, scalability and portability of the application system.
引文
[1]Richard Monson-Haefel.Enterprise JavaBeans[M].2005
    [2]Rima Patel,Sriganesh.Mastering Enterprise JavaBeans[M].Publishing,2005
    [3]Rod Johnson,Juergen Hoeller.Expert one-on-one J2EE Development without EJB[M].US:Wiley Publishing,2004
    [4]Rod Johnson,Juergen Hoeller.Expert one-on-one J2EE Design and Development [M].US:Wiley Publishing,2003
    [5]Ana V,Melo D,Moutinho M.One the Composition of Java Frameworks Control Frow.ACM,2003
    [6]Turk M,Pentland A.Eigenfaces for recognition[J].Journal of Cognitive Neuroscience,1991,3(1):71-86
    [7]仲红艳.控制反转技术分析[J].计算机技术与发展,2005,16(11):60-61
    [8]Robert E.Filman,Tzilla Elrad,Siobhan Clarke,Mehmet Aksit.Aspect-Oriented Software Development[M].2005
    [9]J Viega,P Chandri.Applying Aspect-Oriented Programming to Security[J].Cutter IT Journal,14(2):105-108
    [10]柴晓路.用J2EE架构企业级应用[M].北京:UML软件工程组织,2003:11-23
    [11]Venners Bill.Inside the Java2 Virtual Machine[M].News York,1999
    [12]沈林峰,陈明宇.一种远程系统调用机制的研究及其应用[J].计算机工程,2006,32(11):89-91
    [13]Halpin T.Object Role Modeling:An Overcview.White Paper,www.orm.net,1998
    [14]Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides.Design Patterns:Element of Reusable Object-Oriented Soft-ware[M].1990
    [15]Eric Freeman,Elisabeth Freeman.Head First Design Patterns[M].2005
    [16]William Crawford,Jonathan Kaplan.J2EE Design Patterns[M].US:O'Reilly,2003
    [17]Nanni L,Maio D.Weighted sub-Gabor for face recognition[J].Pattern Recognition Letters,2007,28:487-492
    [18]Jason Hunter,William Crawford.Java Servlet Programming 2nd[M].US:O'Reilly,2001
    [19]Hans Bergsten.JavaServer Pages[M].O'Reilly,2003:320-345
    [20]吴钢,郝克刚,葛玮.控制反转模式及其应用[J].计算机技术与发展,200612(23):71-73
    [21]Bruce Eekel.Think in Java[M].2004
    [22]王栋.构件运行支撑平台PKUAS中管理框架的设计和实现:[硕士学位论文].北京:北京大学,2004:32-38
    [23]Fabio Kon,Fabio Costa,Gordon Blair,et al.The case for reflective Middleware[J].Communications of ACM,2002 45(6):874-881
    [24]付登科,郝克刚,葛玮.AOP改进观察者模式—实现关注点的分离[J].计算机应用,2005 25(12):411-413
    [25]Rod Johnson,Juergen Hoeller.Spring Reference Documentation[M].2005
    [26]Rod Johnson,Juergen Hoeller,Alef Arendsen.Spring Framework 2.0 Reference Manual.http://static.spdngframework.org/spring/docs/2.0.x/reference/index.html,2007
    [27]庄巧莉,吴华.面向AOP构建健壮可扩展的系统[J].计算机应用与软件,2007,24(8):78-79
    [28]黄海,朱跃龙.J2EE设计模式与框架技术的应用研究[J].计算机与现代化,2006 18(5):115-116
    [29]凌晨,陈芳莉.面向方面程序设计技术[J].计算机系统应用,2006.2
    [30]蔡雪煮编著.Hibernate 开发及整合应用大全[M].北京:清华大学出版社,2005.5
    [31]Ted Neward.Effective Enterprise Java[M].US,2004
    [32]Deepak Alur,John Crupi,Dan Malks.Core J2EE Patterns 2nd[M].US:Prentice Hall PTR,2003
    [33]施伟,张忠能.轻量级容器的设计与应用[J].计算机工程,2005,32(20):66-68
    [34]娄锋,孙涌.轻量级IoC容器的研究与设计[J].计算机技术与发展,2007,17(1):92-93
    [35]Adatia著,喻文中,邱仲潘.EJB编程指南[M].北京:电子工业出版社,2002
    [36]邹玲,黄杰.一种新颖的面向方面的Web应用访问控制方法[J].计算机工程与应用,2007 43(36):111-113
    [37]郭禾,刘天阳,陈锋,王宇新.一种基于AOP的软件演化策略设计与实现[J].2007,47(2):271-273
    [38]黄强.基于IoC和AOP的服务框架核心研究与设计:[硕士学位论文].成 都:西南交通大学,2006:30-33
    [39]闫波.基于拦截器实现EJB容器方法调用[J].北京理工大学学报,2004 15(02):12-14
    [40]刘博.基于J2EE轻量级框架的构建及应用:[硕士学位论文].北京:北京邮电大学,2007:10-18
    [41]胡永昌.基于轻量级容器的J2EE开发研究与应用:[硕士学位论文].成都:电子科技大学,2007:40-47
    [42]张玉东,刘广钟.基于J2EE平台和Web服务的企业应用集成方案[J].计算机工程与设计,2004,16(11):50-51
    [43]程洪,钱乐秋,马舜雄.基于J2EE体系的Web应用框架整合[J].计算机工程,2005,31(20):97-98
    [44]林泊,周明辉,梅宏.一个J2EE应用服务器的Web容器集成框架[J].软件学报,2006,17(5):1196-1202
    [45]余冬梅,张秋余,孙岩国.J2EE体系的事务处理的研究[J].计算机工程与设计,2004,25(11):1917-1919
    [46]徐罡,黄涛.Effective XML:有效使用XML的50种方法[M].北京:电子工业出版社,2005
    [47]丁晓宁,张昕,黄涛.一种任务类型敏感的J2EE事务调度算法[J].软件学报,2006 17(01):32-37
    [48]Erik Hatcher,Steve Loughran.Java Development With Ant[M].US:Manning Publications,2003
    [49]刘晓华.J2EE企业级应用开发[M].北京:电子工业出版社,2003
    [50]陈吴鹏,张保稳.J2EE应用服务器事务服务的实现[J].计算机应用与软件,2004,21(10):2-3
    [51]胡建华,陈宁江.实体Bean容器管理持久化研究与实现[J].计算机科学,2005,32(4):174-176
    [52]杨勇,刘红军.基于IoC容器的异构数据集成技术[J].计算机应用,2007,15(10):27-29
    [53]高剑,朱程荣.Spring框架在数据持久层的应用研究[J].微机发展,2007,15(11):106-108
    [54]Startk著,罗时飞译.JBoss管理与开发核心技术[M].北京:电子工业出版社,2004:262-286
    [55]吐拉川著,肖国尊,马擎予译.EJB2.0组件开发指南[M].北京:清华大学出版社,2002
    [56]朱铮雄.基于Spring框架的Web Services系统整合与研究[J].计算机应用与软件,2007,24(10):129-132
    [57]Didier Martin.XML高级编程[M].北京:机械工业出版社,2001
    [58]孙卫琴,李洪成.Tomcat与Java Web开发技术详解[M].北京:电子工业出版社,2004:174-182.
    [59]汤琪亮,高海锋.Java Server Faces技术在网络开发中的应用[J].计算机工程与设计,2006.5
    [60]范同祥,宋恒.一种基于J2EE的通用访问控制框架[J].计算机应用研究,2005,17(5):116-117
    [61]张海藩.软件工程导论[M].北京:清华大学出版社,1998