loading table of contents...

4.1.3.2. Component Artifacts

Component artifacts provide a piece of business (or other high level) functionality by bundling a set of services that are defined in library artifacts. Components follow the naming scheme "<componentKey>-component.jar. The component artifact cae-component.jar for example, bundles all services that are typically required by a CAE web application based project.

Component artifacts are automatically activated on application startup, in contrast to library artifacts. That is, Spring beans and properties are loaded into the application context and servlets and so on will be instantiated. Therefore, you can add a component by simply adding a Maven dependency. No additional steps (such as adding an import to a Spring file) are necessary.

The following files allow you to declare services for a component which are automatically activated:

  • /META-INF/coremedia/component-<componentname>.xml:

    An entry point for all component Spring beans. Either declared directly or imported from library artifacts.

  • /META-INF/coremedia/component-<componentname>.properties:

    All configuration options of the component as key/value pairs. These properties might be overridden by the concrete application.

  • /META-INF/web-fragment.xml: A Servlet 3.0 fragment of a web.xml file that declares component specific servlets, listeners, etc. (see  http://www.oracle.com/technetwork/articles/javaee/javaee6overview-part2-136353.html )

[Note]Note

Consider extending com.coremedia.springframework.web.ComponentWebApplicationInitializer instead of writing a web-fragment.xml so that your component's servlet configuration (listeners, filters, etc.) can be disabled at application startup time by passing a list of component names as property components.disabled to the web application. The property is read using an instance of spring's Standard Servlet Environment.