Titlu Spring 2.5 Aspect Oriented Programming

Autor Massimiliano Dessì
Categorie De specialitate
Subcategorie Calculatoare / IT

descarca-massimiliano-dessi-spring-25-aspect-oriented-programming-pdf

What this book covers Chapter 1 introduces the ideas that led to Aspect-Oriented Programming. An overview of the main concepts of AOP is used to describe components and features provided by Spring AOP, while a set of concise yet clear examples lets the reader discover what can actually be done with AOP. Chapter 2 describes in detail the fundamentals of AOP in Spring, presenting interfaces and classes introduced in early 1.x versions of the framework. This chapter shows how to use AOP programmatically, to let the reader discover the basis of Spring AOP and the components that implement Aspect-Oriented Programming in Spring. Chapter 3 explains how the weaving of AOP components is done using the proxy pattern and �DK or CGLIB implementations. It describes the purpose of proxies and how to use them effectively. Some practical examples show how to use the proxies programmatically, with annotations and with XML; they explain the ProxyFactoryBean and how to make the programmer's work easier with AutoProxy. The chapter describes also some smart techniques on target sources. Chapter 4 explains how Spring AOP is supported by AspectJ. Configuration activity is made simpler, more flexible, and more powerful, thanks to annotations and the syntax of Aspect� on pointcuts (without which those constructs would not be available). All examples show how to use Aspect� with both annotations and XML. The chapter contains practical recipes for specific cases, such as the injection of dependencies on domain objects, the management of aspects' priority, the use of different life cycles for Aspects, and how to use Load Time Weaving. The chapter ends with some strategies on how to choose different AOP approaches to fulfill specific requirements. Chapter 5 describes the design alternatives that can be implemented using AOP. These alternatives are solutions for common requirements: concurrency, caching, and security. Using AOP, they can be achieved in a very elegant and easy way, being at the same time totally transparent for the system where they are applied. Chapter 6 introduces Domain-Driven Development as an alternative way to design applications. The prototype example presented in this chapter is a typical Three-Layer application, where DDD is used for design and AOP is used to inject the dependencies on domain objects. iBatis is used for persistence to the database.