Java Reference
In-Depth Information
To add the Spring Framework to your project, right-click your project and select Build Path ➤ Configure
Build Path to display the Java Build Path window as illustrated in Figure
5-3
. Now add the external
JARs that you downloaded in your file system from the Apress website.
Figure 5-3.
Adding external JARs
Now let's create actual source files under the looselyCoupledApplication project. First we need to
create a package called
com.apress.decoupled
. To do this, right-click src in the Package Explorer
section, select New ➤ Package, and create the package
com.apress.decoupled
. Then create
Vehicle.java
,
Car.java
, and
Bike.java
, which is the code illustrated in Listings 5-10, 5-11,
and 5-12, under the
com.apress.decoupled
package.
Then create the class
VehicleService
as illustrated in Listing 5-15.
Listing 5-15. Loosely Coupled VehicleService
1. package com.apress.decoupled;
2.
3. public class VehicleService {
4.
5. private Vehicle vehicle;
6.
7. public void setVehicle(Vehicle vehicle) {
8. this.vehicle = vehicle;
9. }