Results 1 to 6 of 6

Thread: Request Based Beans

  1. #1

    Default Request Based Beans

    I am trying to get my service beans scoped as request

    <bean id = "aFlexServiceBeanExported" class = "org.springframework.flex.messaging.remoting.FlexR emotingServiceExporter"
    scope="request">
    <property name = "messageBroker" ref = "mySpringManagedMessageBroker"/>
    <property name = "service" ref = "aServiceBean"/>
    </bean>

    aServiceBeanscope is prototype.

    If you don't use a scope spring will configure aFlexServiceBeanExported as a singleton. But for some reason i am not getting new objects from flex if call the service more than once. aServiceBean acting like a session based ojbect.

    So i changed the aFlexServiceBeanExported to request based. Which nothing worked after that.

    Any one know of a way to make the actual services that the exporter wraps to be request based?

    thanks!

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Well, my first question would be, why are you trying to make them request scoped in the first place?

    If you really need them to be request scoped, I would suggest making the actual service request scoped rather than the exporter. That will likely necessitate using a scoped-proxy as described here:
    http://static.springframework.org/sp...ther-injection
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  3. #3

    Default

    Thanks for the reply..

    I am trying to make my applications request based.

    At first i did make the service request scope.. but I got spring errors. One of which said to use the proxy per your suggestion in your post. I am sort of new to Spring so I did not know what the error message was telling me ..

    Thanks you for the link to the correct place in the documentation.

  4. #4
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Just to reiterate, unless you have a good technical reason for using request scope, I would recommend sticking with the default singleton. I would consider that best practice in the majority of cases.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  5. #5

    Default

    I can see how singleton and request based would be very similar.
    But with singletons wouldn't you have to worry about concurrency issues, verses possible GC performance issues with request based that keeps generating new objects?

    thx

  6. #6
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    You don't have to worry about concurrency issues as long as you design your services to be stateless, which is also best practice.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

Posting Permissions

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