Announcement Announcement Module
Collapse
No announcement yet.
Scoped Beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scoped Beans

    Hi together,

    I'm using SI and need some help concerning scoped beans.

    In my application I have beans which should be created and destroyed through a specific HTTP request. Each request that contains a unique conversation id should have access to these beans.
    I can't use the session scope because there are several HTTP requests in different HTTP sessions.

    How can I solve this?

    Thanks in advance,
    Thomas

  • #2
    Request scope

    You can use the request scope

    Comment


    • #3
      Hi,

      As I undestand the request scope, the container will create a new bean for each HTTP request.
      That is not what I want. I will use one bean across multiple HTTP requests from different HTTP sessions.

      ~Thomas

      Comment


      • #4
        So you need a single bean for various request /sessions? Which means you need a singleton scoped bean?

        -Hetal

        Comment


        • #5
          I need a bean instance for each HTTP request with a specific conversation id.
          So the container should create a new instance if a HTTP request contains a new conversation id.

          ~Thomas

          Comment


          • #6
            Hi,

            May be you can check the secttion 3.7.3 in ref doc http://static.springsource.org/sprin...nce/beans.html

            -Hetal

            Comment


            • #7
              You could define a custom scope, but my first advice would be not to go there. Not that the api is not clean, but if you can avoid thinking about scopes you'll save yourself (and the maintenance programmers after you) a headache.

              Comment


              • #8
                Hi Iwein,

                the reason why I'm thinking about scopes is, that my service holds a state. The additional requirement is, that the service must handle multiple sessions (no HTTP sessions). Several HTTP clients can send requests to the service. The conversation id is part of the HTTP request. So I have to decide which request is connected with which service instance.

                If I define a custom scope I don't know how to signal the end of the scope.

                ~Thomas

                Comment

                Working...
                X