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?
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:
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.