Java Reference
In-Depth Information
{
ex . printStackTrace ();
throw
throw new
new RuntimeException ( ex );
}
HashSet < Object > set = new
new HashSet ();
set . add ( springContext . getBean ( "customer" ));
set . add ( springContext . getBean ( "order" ));
set . add ( springContext . getBean ( "product" ));
set . add ( springContext . getBean ( "store" ));
return
return set ;
}
}
The getSingletons() method is responsible for initializing Spring and registering any
JAX-RS resource beans created by Spring with the JAX-RS runtime. It first looks up the
name of the Spring XML configuration file. The filename is stored in a servlet context's init
parameter named spring-beans-file . The getSingletons() method looks up this init
parameter via the injected ServletContext .
After getSingletons() gets the name of the config file, it then initializes a Spring Applic-
ationContext from it. Finally, it looks up each JAX-RS bean within the project and re-
gisters it with the JAX-RS runtime.
Build and Run the Example Program
Perform the following steps:
1. Open a command prompt or shell terminal and change to the ex14_2 directory of the
workbook example code.
2. Make sure your PATH is set up to include both the JDK and Maven, as described in
Chapter 17 .
3. Perform the build and run the example by typing maven install .
Search WWH ::




Custom Search