Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:45:34+00:00 2026-06-02T00:45:34+00:00

I wonder how applying the different bean scopes in CDI ( @ApplicationScoped , @SessionScoped

  • 0

I wonder how applying the different bean scopes in CDI (@ApplicationScoped, @SessionScoped and @RequestScoped) works. I understand the life cycle, but where in the container are these stored? I am using these annotations on JSF beans.

How are these beans stored on the server and how is the server capable of knowing which beans belong to who.

For example is a bean that have a @SessionScoped stored in the HTTPSession object behind the scenes? Are beans with @ApplicationScoped stored in a map instance variable in ServletContext? If so, what about thread safety. I guess I have misunderstood it but it would be great if somebody could teach me what happens, where they are stored (the different scopes), how is the server capable of knowing which beans belongs to who…like are there any other ids (not only session id)?

I am btw using Java EE 6 all Reference Implementations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:45:36+00:00Added an answer on June 2, 2026 at 12:45 am

    For example is a bean that has an @SessionScoped stored in the HTTPSession object behind the scenes? Are beans with @ApplicationScoped stored in a map instance variable in the ServletContext?

    For the web layer, that is indeed what happens. If the bean has been instantiated you can often find it back there by manually iterating over all objects in said maps.

    @RequestScoped is a special thing though. In the web layer this corresponds with the request attribute map, but this scope also applies to calls to e.g. remote session beans, or message driven beans processing a message. In that case, there is no http request and hence no request attribute map. It’s likely that those are stored ‘somewhere else’, probably in TLS (Thread Local Storage) that’s set and unset by the bean proxy.

    If so, what about thread safety.

    Application- and Session scoped beans are by themselves simply not thread safe. You have to take care of thread-safety, for instance by using thread-safe data structures, the synchronized keyword, or a bean type that’s inherently thread-safe (like a @Stateful annotated bean).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i wonder if it is possible to auto mock a container in MOQ without
I've found Lombardi's Blueprint as an example of applying GWT. It's awesome. I wonder
wonder if someone can help me i know what i want to achive but
I wonder what scopes folowing two bindings have: bind(PermissionManager.class).in(Singleton.class); and bind(PermissionManager.class); I have read
Wonder if anyone can help me, the map displays fine but the marker does.
wonder if anyone can help - I thought I had solved this but i
wonder why when I export my project to *.air and I install it on
wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td>
wonder whether someone can help me with the following one... I have a struct
wonder if someone could help me with a little problem. I have session values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.