> Markdown version of [CDI](https://vaadin.com/docs/v23/integrations/cdi). Section index: [llms.txt](https://vaadin.com/docs/v23/integrations/llms.txt)

# Using CDI with Vaadin

The [Vaadin CDI](https://vaadin.com/directory/component/vaadin-cdi/) add-on allows you to use Vaadin with [CDI](https://tools.jboss.org/features/cdi.html).

## <a id="tutorial"></a>Tutorial

A tutorial application which showcases the basic usage of a Vaadin CDI application is available at <https://github.com/vaadin/flow-cdi-tutorial>. You can use this application example to test the different concepts and features presented in the documentation.

## <a id="starting-a-project"></a>Starting a Project

To start a new project with CDI and Vaadin, you can get a project base for Vaadin and CDI from [`vaadin.com/hello-world-starters`](https://vaadin.com/hello-world-starters). This is a project template with the necessary configuration and dependencies included for starting to build your own application. This starter is also available for cloning from [GitHub](https://github.com/vaadin/cdi).

## <a id="adding-dependencies"></a>Adding Dependencies

The `vaadin-cdi` add-on should be packaged in your application and deployed to an application server that’s compliant with Java EE 7 or later.

If you are a `vaadin-platform` user, add the following dependencies in your `pom.xml`.

For example: .`pom.xml`

```xml
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
         <groupId>com.vaadin</groupId>
         <artifactId>vaadin-cdi</artifactId>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
```

## <a id="vaadin-version-compatibility"></a>Vaadin Version Compatibility

The version for `vaadin-cdi` is managed by `vaadin-bom`.

You need the CDI API version 1.2 and a provided implementation. In practice, because other Java EE/Jakarta EE features are used together with CDI, the simplest way to ensure compatibility is to use a Java EE 7 or later container.

## <a id="configuring-the-vaadin-cdi-add-on"></a>Configuring the Vaadin CDI Add-On

No specific CDI configuration options exist.

An instance of the CDI-enabled Vaadin servlet, `com.vaadin.cdi.CdiVaadinServlet`, is deployed automatically, provided you don’t setup a Vaadin servlet in your `web.xml` or use the `@WebServlet` annotation. You can also customize `CdiVaadinServlet` to suit your setup.

> **Note:** See [Configuration Properties](https://vaadin.com/docs/v23/configuration/properties.md) for more information about Vaadin servlet configuration.
