Results 1 to 3 of 3

Thread: Spring Scope

  1. #1
    Join Date
    Dec 2011
    Posts
    3

    Question Spring Scope

    If a class A has a reference to B and class C is also having the same composite reference to B,but by default bean scope is singleton so in the session if we want to access the two objects then both A & C will be holding the same object of B because its singleton.since it has no meaning why this is taking the singleton scope.Is it make sense.?

  2. #2
    Join Date
    Dec 2008
    Location
    India
    Posts
    295

    Default

    If you need sessionwise different objects then you can use Session scope instead default singleton
    Enjoy
    Rohan Chauhan
    ------------------------------------------------------------------------------
    SpringSource Certified Spring 3.0 Professional


  3. #3
    Join Date
    Dec 2011
    Posts
    3

    Default

    Thanks for the reply Mr.Rohan

    My Question is in the same transaction if i use these two objects by default it will be singleton so both will hold the same copy rite.then my both objects will be holding the same copy ,then we have to manually force this to be prototype or something else rite. why did they defined it as singleton..they would have made it as prototype itself.

    Thanks
    Rathi
    Last edited by Rathi; Dec 12th, 2011 at 11:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •