Using Spring Java Config to wire up Dependencies

11 April 2010

The following tests demonstrate how, in Spring, you can configure your beans explicitly using Java. I wasn't sure if the internal method calls would result in two instantiations of the dependency or not. Clearly, it works as expected, i.e. only one instance is created because the default mode for instantiating beans is singleton scope. The magic is called cglib.