Spring Persistence with Hibernate

Spring Persistence with Hibernate

Spring Persistence with Hibernate


In preparing for the Zirous lunch and learn on Spring I read Spring Persistence with Hibernate by Paul Tepper Fisher from our West Des Moines Public Library.  For our lunch and learn Ben Alibasic and I are going to first focus on Dependency Injection and then Spring.  The book first goes over the benefits of Dependency Injection or DI, this quote here succinctly describes the benefits.

The purpose of dependency injection is to decouple the wok of resolving external software components from your application business logic.  Without dependency injection, the details of how a component accesses required services can get muddled in with the component’s code.  This not only increases the potential for errors, adds code bloat, and magnifies maintenance complexities; i couples components together more closely, making it difficult to modify dependencies when refactoring or testing.

Spring has been around for quite a few years.   It has grown up around the Spring core with many other features.  The basic level of Spring is a lightweight IoC container that wires together your application dependencies.  It also helps enforce best coding practices for developers who use the application.

The Spring framework provides many integration points in which you can “wire up” other dependencies.  The book moves into covering the ORM support that Spring facilitates.  The book covers in depth analysis of how Hibernate and Spring work very well together.  There is some examples of the simple approach to declarative transaction management using the @Transactional annotation.  That is one of the main reason’s Tony Brimeyer cited for our usage of Spring at Zirous.  Another great benefit is that it centralizes the wiring of an application making maintenance and configuration easier for an application.  Although Spring is not a standard in the Java development field it is a defacto standard used by many corporations and organizations.

The book covers Dependency Injection via Autowiring, this method allows you to simply define getters and setters of a particular type or name, putting on the Spring container the onus of figuring out which class to inject. You can accomplish this using the @Autowired  annotations.

No comments yet.

Leave a Reply

Powered by WordPress. Designed by Woo Themes