I'm starting to program in Java (with the Spring Framework) and finding myself confused about the difference between DAOs and Spring's Beans. Do they serve to the same purpose?
What is the difference between DAO and Spring Beans?
6.2k Views Asked by anderson At
3
There are 3 best solutions below
0
On
DAOs are meant to abstract away how the application constructs a data object. More specifically, you can have an interface UserDAO and implement it as a UserHibernateDAO, UserIbatisDAO, UserFileDAO and have them return data in a single format from different sources.
Duffymo explained Spring.
0
On
DAOs are a pattern concept (http://www.oracle.com/technetwork/java/dataaccessobject-138824.html).
Spring Beans are class instances managed by Spring.
Of course you can use Spring IOC to implement an application using DAOs.
DAO == Data Access Object. It's one way to write a persistence layer.
Spring can manage DAO beans and lots of other kinds, like message-driven beans, services, web controllers, and anything else you can encapsulate into a bean.
Spring has three parts: