• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Spring - singleton attribute not available when using namespace  RSS feed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the xmlns and xsi:schemaLocation attributes in my beans tag for my applicationContext.xml file instead of using the dtd for defining DOCTYPE. The problem I'm running into is I can't define the bean tags with singleton="false". I need to have a couple of the classes in the applicationContext file as singletons, but I also need to have some of them not be singletons. There just doesn't seem to be singleton attribute available when I'm using namespace instead of a DTD. Can anyone help?

Thank you in advance,
Fletcher
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Using scope="prototype" if you do not want any object not to be singleton. It is same as singleton = "false"

If you want singleton="true", you do not need to do anything on the bean. The behavior is default.

The latest versions of Spring identify scope.

Hopefully this helps.


 
Fletcher Munson
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I just discovered that myself, but perhaps you could tell me the difference between using request and prototype?
 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fletcher Munson wrote:Thanks. I just discovered that myself, but perhaps you could tell me the difference between using request and prototype?



Request only works in the web environment, so a new object is created on each Web URL Request.

Prototype is everytime you call appContext.getObject(String name) you get a new object.

Mark
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!