Spring框架研究与应用

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

学校代号10536 学号0810802539 分类号TP18 密级公开

硕士学位论文

Spring框架研究与应用

学位申请人姓名肖露

培养单位长沙理工大学

导师姓名及职称龙鹏飞教授

学科专业计算机软件与理论

研究方向软件工程

论文提交日期2011年5月

学校代号:10536

学号:0810802539

密级:公开

长沙理工大学硕士学位论文

Spring框架研究与应用

学位申请人姓名肖露

导师姓名及职称龙鹏飞教授

培养单位长沙理工大学

专业名称计算机软件与理论

论文提交日期2011年4月

论文答辩日期2011年5月

答辩委员会主席车生兵教授

Spring Framework Research and Application

by

Xiao Lu

B.E.( HaiNan University) 2008

A thesis submitted in partial satisfaction of the

Requirements for the degree of

Master of Engineering

in

Computer Software and Theory

in

Changsha University of Science & Technology

Supervisor

Professor Long Pengfei

March, 2011

长沙理工大学

学位论文原创性声明

本人郑重声明:所呈交的论文是本人在导师的指导下独立进行研究所取得的研究成果。除了文中特别加以标注引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写的成果作品。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。本人完全意识到本声明的法律后果由本人承担。

作者签名:日期:年月日

学位论文版权使用授权书

本学位论文作者完全了解学校有关保留、使用学位论文的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。本人授权长沙理工大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。

本学位论文属于

1、保密□,在______年解密后适用本授权书。

2

(请在以上相应方框内打“√”)

作者签名:日期:年月日

导师签名:日期:年月日

摘要

随着JavaEE平台技术的发展,以EJB为体系结构的传统JavaEE平台显得过于笨重,引入了过多的不必要的复杂性。在这种情况下,一种轻量级的低侵入性的JavaEE平台的框架显得迫切需要。Spring框架就是其中一个非常优秀的代表,它提供了各种企业级应用需要的各种基础设施,其强大功能是建立在它的核心机制IoC(Inversion of Control)和AOP(Aspect-Oriented Programming)的基础上。

本文研究了Spring框架的两大核心机制IoC和AOP的实现和应用,主要做了以下几方面的工作:首先探讨了Spring框架的核心思想IoC,分析了Spring IoC的实现机制,包括工厂模式,Java反射机制等。接着探讨了Spring框架的核心思想AOP,分析了Spring AOP的实现机制,包括代理模式、Java动态代理和动态字节码生成技术等。最后提出了以Spring框架为核心、集成Hibernate和Struts的轻量级JavaEE应用解决方案,并应用该解决方案设计并实现了银行合规风险管理系统。系统采用Spring IoC来降低系统各模块之间的耦合度,采用Spring AOP来处理系统中散落在各模块中的横切关注点,实现了业务逻辑代码和辅助代码的分离。

最后本文针对银行合规风险管理系统的安全性和性能要求较高的情况下,对Spring框架进行了扩展,提出了一种注解AOP的解决方案。该方案相比于传统的Spring AOP方案减少了大量冗余配置文件,应用于系统后,通过性能测试对比,发现该方案对系统的性能有较大的提高,这对Spring框架的企业级应用有一定的借鉴价值。银行合规风险管理系统现已开发完成,已投入使用将近大半年,整个系统具有与平台无关性,是一个松耦合的应用系统。Spring框架提高了应用系统的可维护性、可扩展性、可移植性和组件的可复用性。

关键词:Spring框架;控制反转;面向方面编程;银行合规风险管理系统

ABSTRACT

With the development of JavaEE platform technology, the traditional JavaEE platform based on the EJB architecture is too bulky, which brings about too much unnecessary complexity. In this case, a lightweight, low-invasive JavaEE platform is urgently needed. Spring framework is one of the best representatives, which provides a variety of infrastructure that correspond with the enterprise applications, whose powerful function is built on its core mechanism IoC and AOP.

The implementation and application of the two main core mechanisms of spring framework IoC and AOP are represented in this paper, and the following issues are being conducted as follows: first of all, IoC, the main idea of spring framework is studied, and the implementation philosophy of Spring IoC that include the factory pattern, the java reflection and some others are also analyzed; secondly, the idea main of spring framework AOP including the proxy pattern, the java dynamic proxy and the technique of dynamic byte code generation are also analyzed. Lastly a light-weight application project of JavaEE that takes the spring framework as its kernel, and integrates the techniques of Hibernate and Struts is proposed. Then this solution is applied to the design and implementation of the bank compliance risk management system. In this System, the couplings of the modules are reduced by introducing Spring IoC, and crosscutting concerns spread in every module of the system are processed by using Spring AOP, which helps to achieve the goal of segregating the business logical codes and auxiliary codes.

At last, the spring framework is extended and a new annotation AOP solution is presented according to the requirements of security and high performance of the bank compliance risk management system in this paper, which can reduce the redundant configure files effectively in contrast with the old ones. After application into the system and an analysis of performance testing it can be proved that this solution can greatly increase the performance of the system, which can exert some important reference value to the application of spring framework in enterprises. The development of bank compliance risk management system has been finished, and it has been put into operation for almost half a year. The main feature of this system is platform-independent and loose coupling. Thus the application of the spring

相关文档
最新文档