Lesson 38Pulling It All Together: Building the Class Roster with Spring
In this lesson, we pull together the code to convert our Class Roster application into a Spring application. In the new version, we will have Spring do the dependency injection and application wiring that we currently do by hand in the App
class and the service layer unit test. Using the Spring DI container is a foundational Spring skill. Almost all other Spring features (security, AOP, MVC, REST) take advantage of the core Spring DI container, which means that this is something you'll do in just about every Spring project you encounter.
INCLUDE THE SPRING LIBRARIES
To take advantage of the Spring framework, we must ensure that the Spring framework library is included in the Maven POM. As we discussed in the Maven lesson, you must include a dependency
entry for each library we want to include in our project.
Open your pom.xml
file and verify that it includes the code dependencies, as shown in Listing 38.1.
LISTING 38.1
The pom.xml File
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ...
Get Job Ready Java 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.