什么是“Facet”?在JavaEE中?

发布于 2024-08-12 06:27:36 字数 301 浏览 5 评论 0原文

我不仅想知道什么是 Facet,还想知道“在物理层面”什么是 Facet(据我所知,它不是一个单独的罐子,但是什么?)?

我还想知道部署后它对我的应用程序有何影响。我将用真实的例子来解释:

我有 2 个 Facet(由 IDE 创建):Spring Facet 和 Web Facet(用于 jsf)。我将其部署到 Tomcat 并且我的应用程序运行良好。

然后我(通过 IDE)又添加了一个方面 - JPA Facet。我重新部署了应用程序并且......它仍然工作正常:)

所以,我只是好奇那是什么以及为什么我们需要它?

I wonder not only what is Facet but also what is Facet 'in physical level' (as I understand it's not a separate jar, but what?)?

I also wonder how can it affect my application after deploying. I'll explain on real example:

I had 2 facets (which were created by IDE): Spring Facet and Web Facet (for jsf). I deployed it to Tomcat and my application worked fine.

Then I added (by means of IDE) one more facet - JPA Facet. I redeployed application and.. it still worked fine :)

So, I'm just curious what is that and why do we need it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

把人绕傻吧 2024-08-19 06:27:36

这与 Java EE 无关。这是IDE相关的。该术语本身与编程无关。

来自 http://www.thefreedictionary.com/facet

fac·et (fst) n

  1. 在宝石上切割或出现的平坦抛光表面之一
    自然地在水晶上。
  2. 解剖学小而光滑、平坦的表面,如骨头或牙齿上的表面。
  3. 生物学复眼的晶状体视觉单位之一,如
    昆虫。
  4. 作为主题的众多方面之一。请参阅 phase 中的同义词。

它是 4。

在这种特定情况下,它只是项目中要使用的一个方面,以便 IDE 可以拦截它的有关生成器、向导、自动包含库等的内容。例如,如果您添加 JPA 方面,那么您将获得更多选择JPA 的 IDE 魔法。

This is not Java EE related. This is IDE related. The term is at its own not programming related.

From http://www.thefreedictionary.com/facet

fac·et (fst) n.

  1. One of the flat polished surfaces cut on a gemstone or occurring
    naturally on a crystal.
  2. Anatomy A small, smooth, flat surface, as on a bone or tooth.
  3. Biology One of the lenslike visual units of a compound eye, as of an
    insect.
  4. One of numerous aspects, as of a subject. See Synonyms at phase.

It's 4.

In this specific case it's just an aspect which is to be used in the project, so that the IDE can intercept on it with regard to generators, wizards, auto-include libraries and so on. If you add for example the JPA facet, then you will get more options to do the IDE-magic with JPA.

世界等同你 2024-08-19 06:27:36

正如 BalusC 所说,这与 Java EE 无关,而是与 IDE 相关。这允许以灵活的方式向项目添加“特性”。

来自 面向 Eclipse 用户的 IntelliJ IDEA 问答(因为您提到了 IDEA):

问:分面 — 它们的用途是什么?

A:简化项目配置。

分面封装了对
各种框架、技术
和语言。例如,要启用
Spring 在你的项目中,你只有
添加相应的方面。全部
下载库并
配置好后,您将获得全方位的
编码协助、重构等
此外,代码模型也是
被认可,所以你完全自由
无需担心任何配置
问题。

在大多数情况下,您可以添加多个
与您相同类型的一个方面
项目。例如,您可以有
用于部署的多个 Web 方面
应用程序到不同的服务器,或
几个 EJB 方面,每个方面都有自己的
EJB 版本。 (另见项目
配置。)

是的,Eclipse 也使用“Facets”:

alt text

AFAIK,NetBeans 没有t (请参阅问:如何配置 Web 框架对于我的项目?)。

As BalusC said, this is not Java EE related but IDE related. This allows to add "characteristics" to a project in a flexible way.

From the IntelliJ IDEA Q&A for Eclipse Users (because you mentioned IDEA):

Q: Facets — what they are for?

A: To streamline the project configuration.

Facets encapsulate the support for a
variety of frameworks, technologies
and languages. For example, to enable
Spring in your project, you only have
to add the corresponding facet. All
libraries are downloaded and
configured, you get the full range of
coding assistance, refactorings, etc.
Moreover, the code model is also
recognized, so you are completely free
from worrying about any configuration
issues.

In most cases, you can add more than
one facet of the same type to your
project. For example, you can have
multiple Web facets for deploying the
application to different servers, or
several EJB facets, each for its own
EJB version. (See also Project
Configuration.)

And yes, Eclipse uses "Facets" too:

alt text

AFAIK, NetBeans doesn't (see Q: How do I configure a web framework for my project?).

盗琴音 2024-08-19 06:27:36

日食 & Intellij 文档,Facets 定义特性和要求(某些配置,特定于特定框架/技术)。

当您向项目添加构面时,该项目将被配置为执行特定任务、满足特定要求或具有特定特征。

简而言之,您必须遵循某些结构来实现某些框架/技术。 IDE 可以为您提供实施选项,让您的生活更轻松。

为了详细阐述它,我将直接从 Eclipse 文档中提供一些完整的详细信息。这是 Eclipse 特定的

< strong>创建项目您将可以选择为您的项目实施facet。例如,EAR 方面通过添加部署描述符并设置项目的类路径来设置项目以充当企业应用程序。

要将另一个方面添加到已存在的项目,请完成以下步骤:

  1. 在 Java™ EE 透视图的 Project Explorer 视图中,右键单击该项目,然后选择 Properties。
  2. 在“属性”窗口中选择“Project Facets”页面。此页面列出了项目中的方面及其版本。
  3. 单击修改项目并选中您希望项目具有的方面旁边的复选框。

注意:仅列出对项目有效的方面。

某些方面可能无法协同工作。因此,您还可以 从预设列表中选择预设的构面组合

  1. 通过单击当前版本号并从下拉列表中选择所需的版本号,为构面选择版本号。
  2. 可选:要删除构面,请清除其复选框。并非所有面都可以删除。
  3. 可选:如果您想要限制项目以使其与一个或多个运行时兼容,请单击“运行时”选项卡并选择您希望项目兼容的运行时。有关运行时的更多信息,请参阅为 J2EE 项目指定目标服务器。
  4. 单击“完成”退出“修改分面项目”对话框,然后单击“确定”。

Facets 在 Eclipse 中也有版本号。 只要不超出构面的要求,您就可以更改构面的版本号
要更改项目中构面的版本,请完成以下步骤:

  1. 在 Java EE 透视图的 Project Explorer 视图中,右键单击项目,然后选择 Properties。
  2. 在“属性”窗口中选择“Project Facets”页面。此页面列出了项目中的方面及其版本。
  3. 单击“修改项目”,然后单击要更改的方面。
  4. 从构面名称旁边的下拉框中选择构面的版本。
  5. 单击“完成”关闭“修改分面项目”窗口,然后单击“确定”。

您可以使用切面做更多事情。为了让您更好地理解,我举了一些例子。有关详细信息,请参阅您喜欢的 IDE 的文档。

As explained in Eclipse & Intellij documentation, Facets define characteristics and requirements (certain configuration, specific for a particular framework/technology).

When you add a facet to a project, that project is configured to perform a certain task, fulfill certain requirements, or have certain characteristics.

In Brief You Have to Follow Some structure to Implement some framework/technology. IDEs have options to implement it for you to make your life easier.

To elaborate it in details I am giving some thorough details directly from Eclipse Documentations. This is Eclipse specific.

While creating a project you will get the option to implement facet for your project. For example, the EAR facet sets up a project to function as an enterprise application by adding a deployment descriptor and setting up the project's classpath.

To add another facet to a project that already exists, complete the following steps:

  1. In the Project Explorer view of the Java™ EE perspective, right-click the project and then select Properties.
  2. Select the Project Facets page in the in the Properties window. This page lists the facets in the project and their versions.
  3. Click Modify Project and select the check boxes next to the facets you want the project to have.

Note: Only the facets that are valid for the project are listed

Some facets may not work together. Thus, you can also choose a preset combination of facets from the Presets list.

  1. Choose a version number for the facet by clicking the current version number and selecting the version number you want from the drop-down list.
  2. Optional: To remove a facet, clear its check box. Not all facets can be removed.
  3. Optional: If you want to limit the project so it will be compatible with one or more runtimes, click on the Runtimes tab and select the runtimes that you want the project to be compatible with. For more information on runtimes, see Specifying target servers for J2EE projects.
  4. Click Finish to exit the Modify Faceted Project dialog and then click OK.

Facets also have version numbers in Eclipse. You can change the version numbers of facets as long as you stay within the requirements for the facets.
To change the version of a facet in your project, complete the following steps:

  1. In the Project Explorer view of the Java EE perspective, right-click the project and then select Properties.
  2. Select the Project Facets page in the in the Properties window. This page lists the facets in the project and their versions.
  3. Click Modify Project and click the facet you want to change.
  4. Select the version of the facet from the drop-down box next to the facet's name.
  5. Click Finish to close the Modify Faceted Project window and then click OK.

You can do more things with the facets. I have given the examples for your better understanding. For details, please go through the documentation of your favorite IDE.

梦行七里 2024-08-19 06:27:36

Facets 是一个 Web 应用程序框架,它在服务器端利用简单的 MVC 架构,在客户端利用功能丰富的 Javascript 组件模型。这两个部分旨在无缝集成,适用于非常动态的 AJAX 风格应用程序

Facets is a web application framework that leverages a simple MVC architecture for the server side and a feature-packed Javascript component model for the client. The two pieces are designed to be seemlessly integrated for very dynamic AJAX-style apps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文