File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes in spring application, no any Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "in spring application, no any "new" operator for create instance?" Watch "in spring application, no any "new" operator for create instance?" New topic
Author

in spring application, no any "new" operator for create instance?

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
I see many spring tutorial and they said about dependency injection, but is it in a spring application, there is no any "new" operator used?
as in local variable, still need to use "new" keyword, is it?
Ayan mallick
Ranch Hand

Joined: Nov 17, 2012
Posts: 45
I think in spring new operator we use when inside a singleton bean we want to use any bean which we want fresh with every request.for example say inside a controller bean we want a form bean to display a form.
controller bean is singleton so only once it will be formed. but form bean needs to be created with every request because user data is going to change state of that form bean.

I think in this scenario instead of using dependency injection we use new operator.


Thanks

Ayan
 
 
subject: in spring application, no any "new" operator for create instance?