Results 1 to 6 of 6

Thread: I need a new object

  1. #1
    Join Date
    Apr 2005
    Location
    Brazil
    Posts
    66

    Default I need a new object

    Hello guys, =)

    I'm using the applicationContext to get a bean.
    in formBackingObject of a SimpleFormController.

    this.getApplicationContext.getBean("bean");

    in a first flow, I'm receiving it ok. in a second one, the bean is filled with the data of the first flow. I'm not getting a new bean. and I've setted the singleton propertie to false.

    is there something wrong with the ApplicationContext? how does it work? if singleton is false, should I get a new instance in every request "getApplicationContext.getBean("bean");" to the beanFactory?

    thanks in advance.

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Can you post the applicationContext.xml and the code you are having problems with. Calls to a bean which is marked as singleton="false" (scope="prototype") will return a new instance.

  3. #3
    Join Date
    Apr 2005
    Location
    Brazil
    Posts
    66

    Default

    how does this scope thing work?

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Scope is a 2.0 change, see reference manual. If you are using 1.2 or 2.0 with dtd then singleton="false" is fine.
    http://www.springframework.org/docs/...factory-scopes

  5. #5
    Join Date
    Apr 2005
    Location
    Brazil
    Posts
    66

    Default

    well, My problem is resolved. thank u very much.

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Ok, out of interest.......... what was your problem?

Posting Permissions

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