Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Definition

Create a container instance

Example using the Java API

If you're using the Java API there are 2 solutions to instantiate a container:

  • by simply instantiating the Java object implementing the container and passing a Configuration object to it. For example:
  • by using the DefaultContainerFactory class. The advantage is that you can instantiate the container by name and thus your code can be generic which is nice if you plan to run the same code with different containers. For example, to instantiate a Resin 3.x installed local container:

In general we recommend that you use the factory method to instantiate a container as this makes your code more flexible.

The class or container id to use for instantiating a container can be found on each container's documentation page:

Example using Cargo extensions

If you're using a Cargo extension you'll use the way defined by the extension to instantiate a container. Underneath, all extensions use the factory method to instantiate containers.

  • No labels