O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing Inversion of Control

One of Spring's benefits is that most of the objects managed by Spring are unaware of the Spring framework API. This makes it easy to use Java code to create and wire together an instance of the class being tested with its required dependencies.

Look at the Spring context with two configured objects, as shown in the following code:

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans- 2.5.xsd"> <bean id="studentService" class="com.packtpub.springhibernate.ch15.StudentService"> <property name="studentDao"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required