![]() ![]() Spring AOP provides several aspects that make it possible to declare transaction policies for JavaBeans. If you used Spring AOP for transaction handling you could place the appropriate method calls declaratively, rather than having to place each one individually. Obviously, you could write the support for these services directly into each class requiring it, but you would likely end up rewriting the same transaction-handling code for numerous transactional contexts. Such applications often require services such as security and transaction support. Take an enterprise application, for example. You can reuse such objects across JEE environments (Web or Enterprise JavaBeans(EJB)), standalone applications, test environments, and so on, without any hassle. A central focus of Spring is to allow for reusable business and data-access objects that are not tied to specific JEE services. Also, you can adapt most of it to non-managed environments. You can use Spring framework functionality in any Javaâ„¢ Enterprise Edition (JEE) server. Such modularized concerns are known as aspects. If you modularize crosscutting concerns, such as logging and transaction management, it becomes possible to add new features to your code without modifying each class individually. With AOP, you still define a system’s common functionality in one place, but you can declaratively define how and where to apply this functionality. The result is sometimes known as code tangling, or more simply, “a mess.” Aspect-oriented programming is a programming technique that seeks to resolve this problem by promoting separation of concerns as a core programming concept. System services such as logging, transaction management, and security frequently find their way into components whose core responsibility is something else. Often, however, these components carry additional responsibility beyond their core functionality. Software systems are typically composed of several components, each responsible for a specific area of functionality. Because this banking example incorporates the declarative transaction handling of Spring AOP and the persistence backbone of Spring Hibernate, I’ll start with a closer look at each of these technologies. Now, I pick up where I left off and, with an example similar to the one you encountered last time, demonstrate Spring’s persistence support. I then used a simple example to show you how the IOC pattern (as implemented by the Spring IOC container) works to integrate disparate systems in a loosely coupled manner. In the previous installment of this series, I introduced the seven modules of the Spring framework, including Spring AOP and the inversion of control (IOC) container. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |