> Markdown version of [Using Vaadin with CDI](https://vaadin.com/docs/v14/flow/integrations/cdi/tutorial-cdi-basic). Section index: [llms.txt](https://vaadin.com/docs/v14/flow/llms.txt)

# Using Vaadin with CDI

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="adding-dependencies"></a>Adding Dependencies

The `vaadin-cdi` add-on should be packaged in your appplication and deployed to an application server that is compliant with Java EE 7 (or newer).

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

**Example** CDI dependencies in `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`. For Vaadin 14, the CDI add-on version is 11.0.

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 newer) container.

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

There are no specific CDI configuration options.

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

> **Note:** See [Runtime Configuration](https://vaadin.com/docs/v14/flow/configuration.md) for more about about Vaadin servlet configuration.

## <a id="getting-started-with-cdi-and-vaadin-tutorial"></a>Getting Started with CDI and Vaadin Tutorial

[Vaadin CDI tutorial](https://github.com/vaadin/flow-cdi-tutorial) is a prebuilt example application that showcases basic usage of a Vaadin and CDI. You can use it to test the concepts and features covered in this documentation.

To start a new project with CDI and Vaadin, select the **CDI and Java EE** technology stack at [vaadin.com/hello-world-starters](https://vaadin.com/hello-world-starters). This project template includes the necessary configuration and dependencies to start building you own application.

`C26B9CF3-6499-4451-9CE5-373889ECC7D1`
