简体   繁体   English

GlassFish域中的JSF托管Bean唯一性

[英]JSF Managed Bean Uniqueness in GlassFish Domain

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? 如果我在GlassFish域中的一个应用程序EAR中部署@ManagedBean或CDI @Named JSF支持bean,然后在同一GlassFish域中的另一个应用程序EAR中部署相同的托管或命名Bean,这会引起冲突或任何问题吗? For example, I have a LoginController class that is registered as a managed or named bean that I use for login to different applications. 例如,我有一个LoginController类,该类已注册为托管Bean或命名Bean,用于登录不同的应用程序。 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. 我还有其他一些通用的,水平的实用程序,这些实用程序已注册为托管Bean或命名Bean,我想在部署为不同EAR的不同应用程序中重复使用,这些EAR可能会或可能不会部署到同一GlassFish域或服务器。 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. 我已经实现了这一点,并且想知道相对于GlassFish域以及跨应用程序/ EAR的托管或命名bean的范围。 What is the best way to accomplish this within JEE and GlassFish? 在JEE和GlassFish中实现此目标的最佳方法是什么?

Every application create it's own CDI context. 每个应用程序都创建自己的CDI上下文。

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. 您可以将上下文想象为一个带有对象的大地图,其中每个应用程序都有自己的地图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM