If I deploy a @ManagedBean or CDI @Named JSF backing bean in one application EAR within a GlassFish domain and then deploy the same managed or named bean in a different application EAR within the same GlassFish domain, will this cause a collision or any problems? For example, I have a LoginController class that is registered as a managed or named bean that I use for login to different applications. I also have some other common, horizontal utilities that are registered as managed or named beans that I would like to reuse across different applications deployed as different EARs that may or may not be deployed to the same GlassFish domain or server. I have implemented this already and am wondering about the scope of managed or named beans relative to the GlassFish domains and across applications / EARs. What is the best way to accomplish this within JEE and GlassFish?
Asked
Active
Viewed 99 times
1
-
side note: JSF Managed Beans are deprecated (as of JSF 2.3). Instead you should use CDI @Named beans – Andy Guibert Oct 28 '17 at 23:46
-
Did you try? Should not be that difficult – Kukeltje Oct 29 '17 at 07:54
-
Thanks @AndyGuibert. I have converted remaining ManagedBean annotations to CDI Named beans, but the fundamental question about scope of the JSF backing beans within the GlassFish environment has not yet been answered. – Chris Oct 29 '17 at 14:43
-
@Kukeltje I have already implemented, but it is difficult to tell if problems that occur may be due to this type of conflict or possibly some other problem with the reused components' implementation, so I am looking for a definitive answer. – Chris Oct 29 '17 at 14:44
1 Answers
0
Every application create it's own CDI context.
Which means applications does not use context of other application on your server.
Therefore you can use same names without any problems.
You can imagine the context as a big map with objects where each application has it's own map.

Milkmaid
- 1,659
- 4
- 26
- 39
-
This was my understanding also. Is there someplace that documents this explicitly in JEE documentation that you are aware of @milkmaid ? – Chris Nov 06 '17 at 15:19
-
@Chris this should answer all of your questions: [LINK](https://stackoverflow.com/a/3106909/4327527) – Milkmaid Nov 08 '17 at 05:59