资源预览内容
第1页 / 共31页
第2页 / 共31页
第3页 / 共31页
第4页 / 共31页
第5页 / 共31页
第6页 / 共31页
第7页 / 共31页
第8页 / 共31页
第9页 / 共31页
第10页 / 共31页
亲,该文档总共31页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
本文是中英对照毕业设计论文外文文献翻译,下载后无需调整复杂的格式直接可用!一辈子也就一次的事!文献引用作者出处信息: Iuliana Cosmina, Rob Harrop, Chris Schaefer, Clarence Ho Pro Spring 5 An In-Depth Guide to the Spring Framework and Its Tools,2020 (如觉得年份太老,可改为近2年,毕竟很多毕业生都这样做)英文5352单词,32576字符(字符就是印刷符),中文8756汉字。(如果字数多了,可自行删减,大多数学校都是要求选取外文的一部分内容进行翻译的。)Introducing Spring AOPBesides dependency injection (DI), another core feature that the Spring Framework offers is support for aspect-oriented programming (AOP). AOP is often referred to as a tool for implementing crosscutting concerns. The term crosscutting concerns refers to logic in an application that cannot be decomposed from the rest of the application and may result in code duplication and tight coupling. By using AOP for modularizing individual pieces of logic, known as concerns, you can apply them to many parts of an application without duplicating the code or creating hard dependencies. Logging and security are typical examples of crosscutting concerns that are present in many applications. Consider an application that logs the start and end of every method for debugging purposes. You will probably refactor the logging code into a special class, but you still have to call methods on that class twice per method in your application in order to perform the logging. Using AOP, you can simply specify that you want the methods on your logging class to be invoked before and after each method call in your application.It is important to understand that AOP complements object-oriented programming (OOP), rather than competing with it. OOP is very good at solving a wide variety of problems that we, as programmers, encounter. However, if you look at the logging example again, it is obvious to see where OOP is lacking when it comes to implementing crosscutting logic on a large scale. Using AOP on its own to develop an entire application is practically impossible, given that AOP functions on top of OOP. Likewise, although it is certainly possible to develop entire applications by using OOP, you can work smarter by employing AOP to solve certain problems that involve crosscutting logic.This chapter covers the following topics:AOP basics: Before discussing Springs AOP implementation, we cover the basics of AOP as a technology. Most of the concepts covered in the “AOP Concepts” section are not specific to Spring and can be found in any AOP implementation. If you are already familiar with another AOP implementation, feel free to skip the “AOP Concepts” section.Types of AOP: There are two distinct types of AOP: static and dynamic. In static AOP, like that provided by AspectJs1 compile-time weaving mechanisms, the crosscutting logic is applied to your code at compile time, and you cannot change it without modifying the code and recompiling. With dynamic AOP, such as Spring AOP, crosscutting logic is applied dynamically at runtime. This allows you to make changes to the AOP configuration without having to recompile the application. These types of AOP are complementary, and, when used together, they form a powerful combination that you can use in your applications.Spring AOP architecture: Spring AOP is only a subset of the full AOP feature set found in other implementations such as AspectJ. In this chapter, we take a high-level look at which features are present in Spring, how they are implemented, and why some features are excluded from the Spring implementation.Proxies in Spring AOP: Proxies are a huge part of how Spring AOP works, and you must understand them to get the most out of Spring AOP. In this chapter, we look at the two kinds of proxy: the JDK dynamic proxy and the CGLIB proxy. In particular, we look at the different scenarios in which Spring uses each proxy, the performance of the two proxy types, and some simple guidelines to follow in your application to get the most from Spring AOP.Using Spring AOP: In this chapter, we present some practical examples of AOP usage. We start off with a simple Hello World example to ease you into Springs AOP code, and we continue with a detailed description of the AOP features that are available in Spring, complete with examples.Advanced use of pointcuts: We explore the ComposablePointcut and ControlFlowPointcut classes, introductions, and appropriate techniques you should employ when using pointcuts in your application.AOP framework services: The Spring Framework fully supports configuring AOP transparently and declaratively. We look at three ways (the ProxyFactoryBean class, the aop namespace, and AspectJ-style annotations) to inject declaratively defined AOP proxies into your application objects as collaborators, thus making your application completely unaware that it is working with advised objects.Integrating AspectJ: AspectJ is a fully featured AOP implementation. The main difference between AspectJ and Spring AOP is that AspectJ applies advice to target objects via weaving (either compile-time or load-time weav
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号