Listing 21-9. The aop.xml File
<aspectj>
<weaver>
<!-- only weave classes in our application-specific packages -->
<include within="com.apress.prospring3.springblog.*" />
</weaver>
<aspects>
<aspect
name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect" />
<aspect
name="org.springframework.transaction.aspectj.AnnotationTransactionAspect" />
</aspects>
</aspectj>
In Listing 21-8, in the context.xml file, we instruct tc Server to use the class loader provided by the
Spring Framework, which supports LTW of classes in Spring's WebApplicationContext. In Listing 21-9,
the aop.xml file defines the LTW configuration for AspectJ. First, we provide the package under which
Spring's AspectJ support should weave the classes. Second, the <aspects> tag defines the aspects to use.
For the SpringBlog application, only two are required. The AnnotationBeanConfigurerAspect aspect (the
suffix is .aj) supports the aspect class with the annotation @Configurable, which marks a class as being
eligible for Spring-driven configuration. The AnnotationTransactionAspect aspect enables the support of
@Transactional annotations in the service layer.
For the coding side, we will discuss the implementation of the obscenity filter in detail in a later
section.
Implementation Details
Having discussed the design and configuration details, let's proceed to the implementation details.
Since the code base is quite large, it's not possible to cover all the classes in detail. So, in the following
sections, we will focus the discussion on the major implementation classes and a high-level overview of
each layer. Topics include implementing the service layer, implementing AOP, scheduling jobs,
implementing the presentation layer, and so on.
Service Layer Implementation
As mentioned in Chapter 3, for the service layer, implementations for using both JPA 2 (with Hibernate
and Spring Data JPA) and MyBatis as the persistence provider will be developed. The details of the
respective implementations will be covered in the following sections. In this section, we will focus the
discussion on the services related to blog post entry.
Listing 21-10 shows the EntryService interface, which defines the services provided by SpringBlog
for blog post entry and will be implemented by both the JPA 2 and MyBatis implementation classes.
Listing 21-10. The EntryService Interface
package com.apress.prospring3.springblog.service;
import java.util.List;
import org.springframework.data.domain.Page;
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home