Topic 12
■■■
Designing and Implementing
Spring-Based Applications
In previous chapters, we discussed various topics related to application development with Spring,
including Spring's ApplicationContext configuration, various DI mechanisms, AOP support for cross-
cutting concerns, and how Spring integrates with different data access technologies for interacting with
backend relational databases.
When discussing implementations of data access logic, you saw how to use different
implementation patterns. For example, in Chapter 8, which covered data access with JDBC, the data
access logic was encapsulated in DAOs. In Chapters 10 and 11, when discussing JPA and MyBatis, we
eliminated the DAO layer and had the JPA's EntityManager and MyBatis's mapper interfaces injected
into the service layer directly. In those chapters, we also mentioned the design of domain objects (or the
entity classes, in JPA terms) and showed how their attributes and relationships were modeled and
mapped to the database structure.
Before we proceed, let's take a short break from programming topics and discuss some of the main
principles in designing and implementing Spring-based applications. We believe that taking a step back
and revisiting the application design practice for JEE applications here will help you better correlate the
topics as we proceed with the overall application architecture.
Application design is a big topic, and we do not intend to cover all aspects of it. In this chapter, we
will discuss some tried-and-tested OOP practices that result in applications that have clearly defined
component responsibilities and that are also easy to test and maintain. This chapter looks at the impact
Spring has on application design, paying particular attention to patterns and practices that you will find
easy to apply when you are building your application with Spring. Much of this chapter focuses on the
design decisions we made when building the SpringBlog application, and we use that application as the
basis for our examples and discussions. In addition to the application design principles, we will discuss
how you can use many of the Spring technologies covered so far to implement the data access and
service layers of the SpringBlog application.
Specifically, in this chapter we look at the following:
Interface-driven design: Interface-driven design is a traditional OOP best practice.
·
When you use interface-driven design, the main components of your application
are defined in terms of interfaces rather than concrete classes. Java offers first-
class support for this kind of design with its notion of interfaces separate from
classes. In this section of the chapter, we discuss interface-driven design in
general terms and why you should use it in your applications.
Building a Domain Object Model: In this section of the chapter, we look at the
·
notion of a Domain Object Model (DOM), a collection of objects that provides an
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home