This page last changed on Jul 17, 2005 by vmassol.
Instantiate a container by name
There are 2 solutions to instantiate a container:
- by explicitely creating a new instance of the container itself (see the Container Instantiation page for more details on creating a container's instance). For example to instantiate a Resin 3.x container:
Container container = new Resin3xContainer();
- 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 container:
ContainerFactory factory = new DefaultContainerFactory();
Container container = factory.createContainer("resin3x");
|