posted 19 years ago
Hi.
I have a question about Spring framework.
As you already know, we can use Spring to manage the dependencies for us.
So, instead of we create an object and pass it to another one, Spring will inject it through setXxx( ) method.
My question is, Whenever Spring calls setXxx( ) method, a new object created -through newInstance( )- ?
Consider this please, my object uses Hibernate to access a database, So what to pass to it ?
SessionFactory ? or just Session ?
AFAIK, SessionFactory is thread-safe and it is heavy to create.
But I'm thinking, how can I ask Spring to pass Session object since we can get it from the factory ?
Well, I'm asking for explaination please.
Thanks.