• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • 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
Posts: 17344
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
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!