Results 1 to 3 of 3

Thread: Request scope and service-to-service requests

  1. #1
    Join Date
    Dec 2011
    Posts
    3

    Question Request scope and service-to-service requests

    The Spring reference mannual states that "the Spring container will create a brand new instance of the [...] bean [...] for each and every HTTP request."

    From what perspective is the manual talking about here, the service or the consumer?

    Will the container create new instances of "request"-scoped beans when I invoke another service from within the current request (as in Consumer->Service 1->Service 2)?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default


    Will the container create new instances of "request"-scoped beans when I invoke another service from within the current request (as in Consumer->Service 1->Service 2)?
    No. The request is the request as in web request (request and session scoped beans only work in web environments). So there will be a new instance for the request which is alive and shared during the lifetime of that request.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2011
    Posts
    3

    Default

    Thank you for confirming that, Marten. I appreciate your clarification!

Tags for this Thread

Posting Permissions

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