What is Facet in JavaEE?

It is interesting not only what Facet is, but also what Facet is 'on the physical level' (since I understand this is not a separate bank, but what?)?

I am also interested in how this will affect my application after deployment. I will explain with a real example:

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

Then I added (using the IDE) another facet - JPA Facet. I redid the application and ... it still worked fine :)

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

+48
java java-ee terminology ide facet
Nov 27 '09 at 17:39
source share
4 answers

This is not related to Java EE. This is due to the IDE. This term is not in itself associated with programming.

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

fac et (fst) n.

  • One of the flat polished surfaces cut with a precious stone or found naturally on a crystal.
  • Anatomy A small, smooth, flat surface, as on a bone or tooth.
  • Biology. One of the lenticular visual units of a compound eye is like an insect.
  • One of the many aspects of the subject. See Synonyms in phase .

This is 4.

In this particular case, this is just an aspect that should be used in the project, so the IDE can intercept it with respect to generators, wizards, automatic libraries, etc. If you add, for example, a JPA face, you will have more options for creating IDE magic using JPA.

+52
Nov 27 '09 at 17:42
source share

As BalusC said, this is not due to the Java EE, but to the IDE. This allows you to flexibly add "characteristics" to the project.

From IntelliJ IDEA Q&A for Eclipse users (since you mentioned IDEA):

Q: Borders - what are they for?

A: To optimize the configuration of the project.

Borders contain support for a variety of frameworks, technologies, and languages. For example, to include Spring in your project, you only have to add the corresponding face. All libraries are loaded and configured, you get a full range of assistance in coding, refactoring, etc. In addition, 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 aspect of one type to your project. For example, you can have multiple web faces to deploy the application to different servers or multiple EJB faces, each for its own EJB version. (See Also Project Configuration .)

And yes, Eclipse also uses "Facets":

alt text

AFAIK, NetBeans (see Q: How do I set up a web framework for my project? ).

+40
Nov 27 '09 at 18:01
source share

Facets is a web application platform that uses a simple MVC architecture for the server side and a functional Javascript model for the client. Two parts are designed to be carefree for very dynamic AJAX style applications.

+2
Jul 05 '13 at
source share

As explained in the Eclipse and Intellij documentation, faces define characteristics and requirements (specific configuration specific to a particular structure / technology).

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

In short, you need to follow some structure to implement some framework / technology. The IDE has options for implementing it to make your life easier.

To describe it in detail, I will detail the detailed information from the Eclipse Documentations. This is the Eclipse Specification .

While creating a project, you will get the opportunity to implement a facet for your project. For example, the EAR facet creates a project to work as an enterprise application by adding a deployment descriptor and setting the path to the project class.

To add another facet to the project , follow these steps:

  • In the Project Explorer view of the Java ™ EE perspective, right-click the project and select Properties.
  • Select the Project Boundaries page in the Properties window. This page lists the faces in the project and their versions.
  • Click "Edit Project" and check the boxes next to the face that you want the project to have.

Note. Only faces that are valid for the project are displayed.

Some faces may not work together. Thus, you can also select a predefined combination of faces from the Presets list .

  • Select the version number for the facet by clicking the current version number and selecting the desired version number from the drop-down list.
  • Optional: To remove a face, clear the check box. Not all faces can be deleted.
  • Optional: if you want to limit the project to be compatible with one or more runtime modes, click the Runtimes tab and select the runtime with which you want the project to be compatible. For more information about runtime, see Defining Destination Servers for J2EE Projects.
  • Click Finish to exit the Edit Project Face dialog box and click OK.

Borders also have version numbers in Eclipse. You can change torch version numbers if you stay within the face requirements. To change the facet version in your project, follow these steps:

  • In the Project Explorer view of the Java EE perspective, right-click the project and select Properties.
  • Select the Project Boundaries page in the Properties window. This page lists the faces in the project and their versions.
  • Click Modify Project and click the cell that you want to modify.
  • Select a facet version from the drop-down list next to the face name.
  • Click Finish to close the Edit Faceted Project window, and then click OK.

You can do more things with faces. I have provided examples for your better understanding. For more information, please see the documentation for your favorite IDE.

+2
Sep 17 '16 at 10:32
source share



All Articles