Chapter 2. Designing Spring Applications
Chapter 1 provided you with a basic understanding of what the Spring framework is and how it is used. This chapter shows how to go about designing a system that uses the Spring framework. One of the key benefits of using Spring, as you will appreciate from this chapter, is that it stays completely out of the way until you need it. Instead of thinking about how the application must fit the framework right at the start, and potentially constraining your design, you simply design your application and then add the Spring framework later!
This may sound a little incredible at first, especially if you are coming from the world of heavyweight frameworks such as J2EE. With Spring, you need not consider up front how clients will connect and access the application, how transactions are handled, how database connections must be managed, how authentication and authorization must be implemented, and so on. All of these concerns, having no direct relation to the application objects and the business logic, can be addressed later on with Spring. This is a benefit delivered by Spring's AOP (aspect-oriented programming) orientation.
When you design a Spring-based system, you can start by constructing a series of interacting POJOs (plain old Java objects), forming the domain model of the system. These POJOs become the core objects in the resulting system. You can then use Spring's inversion of control mechanisms (via annotations and XML-based configuration, as ...
Get Beginning Spring Framework 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.