Java Reference
In-Depth Information
Spring AOP
Spring AOP is an important module that provides critical system-level services. It pro-
motes loose coupling and allows cross-cutting concerns (such as business services and
transactions) to be separated in a most elegant fashion. It allows these services to be
applied transparently through declaration. With Spring AOP, it is possible to write custom
aspects and configure them declaratively. Spring AOP supports the creation of aspects
through AOP Alliance-compliant interfaces. It also supports AspectJ. Spring AOP is a
complicated subject in itself, and a detailed discussion is beyond the scope of this topic.
I will, however, use AOP topics later in Chapter 6, to describe the transaction and security
patterns. So, you may also consider reading a bit about AOP in the topic Foundations of
AOP for J2EE Development (Apress, 2005) and then check out the Spring AOP documenta-
tion at .
Spring DAO
Java EE applications use the JDBC API to connect to and perform operations on rela-
tional databases. However, this often results in a lot of common code being written for
operations such as the following:
• Retrieving a connection from the connection pool
• Creating a PreparedStatement object
• Binding SQL parameters
• Executing the PreparedStatement object
• Retrieving data from the ResultSet object and populating data container objects
• Releasing all database resources
This kind of boilerplate code seriously hurts reusability. Spring JDBC/DAO makes life
very easy by removing the common code in templates. The templates implement the
GOF template method design pattern and provide suitable extension points to plug-in
custom code. This makes the data access code very clean and prevents nagging problems
such as connection leaks, and so on, because the Spring Framework ensures that all data-
base resources are released properly.
Search WWH ::

Custom Search