SeamFramework.orgCommunity Documentation

Chapter 1. Getting Started

1.1. Maven dependency configuration
1.2. Transitive dependencies
1.3. Pre-Servlet 3.0 configuration

Getting started with Seam Solder is easy. All you need to do is put the API and implementation JARs on the classpath of your CDI application. The features provided by Seam Solder will be enabled automatically.

Some additional configuration, covered at the end of this chapter, is required if you are using a pre-Servlet 3.0 environment.

If you are using Maven as your build tool, first make sure you have configured your build to use the JBoss Community repository, where you can find all the Seam artifacts. Then, add the following single dependency to your pom.xml file to get started using Seam Solder:


<dependency>
   <groupId>org.jboss.seam.solder</groupId>
   <artifactId>seam-solder</artifactId>
   <version>${seam.solder.version}</version>
</dependency>

This artifact includes the combined API and implementation.

Tip

Substitute the expression ${seam.solder.version} with the most recent or appropriate version of Seam Solder. Alternatively, you can create a Maven user-defined property to satisfy this substitution so you can centrally manage the version.

To be more strict, you can use the API at compile time and only include the implementation at runtime. This protects you from inadvertantly depending on an implementation class.


<dependency>
   <groupId>org.jboss.seam.solder</groupId>
   <artifactId>seam-solder-api</artifactId>
   <version>${seam.solder.version}</version>
   <scope>compile</scope>
</dependency>

<dependency>
   <groupId>org.jboss.seam.solder</groupId>
   <artifactId>seam-solder-impl</artifactId>
   <version>${seam.solder.version}</version>
   <scope>runtime</scope>
</dependency>

In a Servlet 3.0 or Java EE 6 environment, your configuration is now complete!

Most of Seam Solder has very few dependencies, only one of which is not provided by Java EE 6:

Some features of Seam Solder require additional dependencies (which are declared optional, so will not be added as transitive dependencies):

In addition, a logger implementation (SLF4J, Log4J, JBoss Log Manager or the JDK core logging facility) is required. Refer to Chapter 6, Logging, redesigned for more information about how logging is handled in Solder.

If you are using Java EE 5 or some other Servlet 2.5 container, then you need to manually register a Servlet component in your application's web.xml to access resources from the Servlet Context.


<listener>
   <listener-class>org.jboss.seam.solder.resourceLoader.servlet.ResourceListener</listener-class>
</listener>

This registration happens automatically in a Servlet 3.0 environment through the use of a /META-INF/web-fragment.xml included in the Solder implementation.

You're all setup. It's time to dive into all the useful stuff that Seam Solder provides!