Spring EYE on JAVA EE - 5
Up to now, I have not touched Spring framework. It is time to first experience the power of IoC or DI. In the next section I will focus on the product order functionalities while leave the report functionalities till later purposely.
We can first experience this by creating an integrated Unit Test to see how Spring DI works. SpringDIProductDAOTest.java
is created for this purpose. HibernateProductDAO is annotated as @Autowired, means it will rely on the Spring framework to provide this depended object at run time. Thanks Spring for the provided abstract testing class, my unit test can specify the testing context without the deployment of the full blow Spring framework. @Transactional is another great feather in Spring, the declarative transaction management, thanks for Spring AOP.
spirngDemoContext.xml
, the Spring configuration file need to be adjusted to embed hibernate, datasource, and transaction handling.
SpringDIProductDAOTest.java
Previous Next
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home