java ee - DAO classes Singleton or Prototype Which is the best approach -
i working on dao layer , writing classes. these classes injected in service layer using spring ioc. best approach singleton/prototype (dao classes not have state )
if don't have state, doesn't matter much. leave them singletons, won't have multiple unnecessary instances of same dao.
note that, if services singletons, making dao prototypes create 1 instance per service it's injected anyway.
Comments
Post a Comment