How can I replace an @ApplicationScoped managed bean with my own copy of it in FacesContext? All I have is an instance of FacesContext (I’m inside JSFUnit).
How can I replace an @ApplicationScoped managed bean with my own copy of it
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Application scoped beans are stored in the application map with the managed bean name as key.
So, this should do:
By the way, deeper under the JSF covers up to the Servlet API, the application map is just a mapping of
ServletContextattributes. Useful to know when it happens that you’ve only theServletContextat your hands. And in the same line, the session map maps toHttpSessionattributes and the request map toHttpServletRequestattributes. Use them for session and request scoped beans respectively.