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

  • 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"
    <property name = "messageBroker" ref = "mySpringManagedMessageBroker"/>
    <property name = "service" ref = "aServiceBean"/>

    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?


  • #2
    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:


    • #3
      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
        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.


        • #5
          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?



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