Title: OpenWebBeans FAQ

OpenWebBeans and JavaSE

To add OpenWebBeans to your javaSE project you need to take the following steps:

  1. Add required jars to your project
  2. Bootstrap OpenWebBeans
  3. Done! Congratulations.

###Adding required jars to your project

You can add OpenWebBeans to your project manually by adding jars or with Apache Maven. How to download is explained here: download page. This is especially useful if you are not a maven user since the below links goes directly to the maven coordinates.

For JavaSE you need:

Those two parts of OpenWebBeans are what you could call “system core”. These are the only OWB artifacts you need for JavaSE capabilities and for the time being the existing plugins basically just adds JavaEE capabilities.

You also need to add some spec API jars for the CDI, atinject and interceptors specifications.

After you have added the jars described above to your project accordingly to the download page and added them to your projects classpath.

###Bootstrapping OpenWebBeans

For now we recommend two ways for booting up the OpenWebBeans container: Deltaspike CdiCtrl or booting it yourself in i.e. a standard main method.

Option number one - Apache DeltaSpike CdiCtrl

Apache DeltaSpike is a set of portable CDI Extensions. It contains a module which allows to control various CDI-Containers without having to change your own code. It contains an API and multiple implementations for a few CDI Containers.

For most projects Deltaspike CdiCtrl will be the smoother choice to boot your project in JavaSE .

Option number two - booting yourself**

Going native and booting Apache OpenWebBeans yourself could however be useful if you need full control to do advanced things.

import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.cdise.api.ContextControl;
import javax.enterprise.context.ApplicationScoped;

public class MainApp  {
    private static ContainerLifecycle lifecycle = null;
    public static void main(String[] args)  {
        lifecycle = WebBeansContext.currentInstance().getService(ContainerLifecycle.class);

    public static void shutdown()  {

From here you might want to look at our samples selection: samples.