Book Image

Spring 2.5 Aspect Oriented Programming

Book Image

Spring 2.5 Aspect Oriented Programming

Overview of this book

Developing powerful web applications with clean, manageable code makes the maintenance process much easier. Aspect-Oriented Programming (AOP) is the easiest and quickest way to achieve such results. Spring is the only Java framework to offer AOP features. The combined power of Spring and AOP gives a powerful and flexible platform to develop and maintain feature-rich web applications quickly. This book will help you to write clean, manageable code for your Java applications quickly, utilizing the combined power of Spring and AOP. You will master the concepts of AOP by developing several real-life AOP-based applications with the Spring Framework, implementing the basic components of Spring AOP: Advice, Joinpoint, Pointcut, and Advisor. This book will teach you everything you need to know to use AOP with Spring. It starts by explaining the AOP features of Spring and then moves ahead with configuring Spring AOP and using its core classes, with lot of examples. It moves on to explain the AspectJ support in Spring. Then you will develop a three-layered example web application designed with Domain-Driven Design (DDD) and built with Test-Driven Development methodology using the full potential of AOP for security, concurrency, caching, and transactions.
Table of Contents (13 chapters)

Proxy


It is proxies that realize AOP in Spring and allow the application of crosscutting functionalities. We will see the application of proxies both in the classic version of Spring, and with the support of AspectJ with annotations and XML Schema. We will also see the possible matching of configuration to adapt proxies to our demands, and use their advanced features.

Proxy is a structural design pattern that is a part of the 23 design patterns of the GoF (Gang of Four) composed by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides.

The idea put into practice by Proxy is to wrap an object and intercept all the calls made to it and take its place, so that the calling object has the feeling of interacting with the object rather than the proxy.

Since a proxy intercepts all the calls to the object, it can also decide to call some other application logic before making a call to the object, or to execute some application logic before giving back the object's answer, or it can even not...