Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Jakarta Dependency Injection (DI) TCK

This project contains the Jakarta Dependency Injection TCK and user guide.

Software Requirements

  • A Java SE 11 or 8 runtime

  • Maven 3.3.x


Download the TCK zip and unpack it to create a jakarta-di-tck-x.y directory containing this README and a jakarta-di-tck-x.y.jar file containing the TCK classes.

Install the TCK jar Into Local Repo

Use the following command to install the TCK jar into your local maven repository:

mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \

making sure your replace <path-to-tck-jar> with the expanded download TCK archive directory and the x.y with the corresponding version found in the TCK download, e.g.:

mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file \

Running the TCK

The DI TCK expects to be embedded a JUnit 4.x Test suite that is bootstrapped from within the DI implementation being tested. An example that uses the 5.0.0.CR2 Weld implementation and the standard Java SE bootstrap can be found in the example subdirectory. The Junit suite bootstrap code is as follows:

package weld;

import junit.framework.Test;
import org.atinject.tck.Tck;


public class SampleBootstrapTCK {

    public static Test suite() {

        SeContainer container = SeContainerInitializer
                .addPackages(true, Tck.class)
        Car tckCar =;
        return Tck.testsFor(tckCar, false, true);
  1. Intialize the dependency container, in this case a CDI container.

  2. Resolve the instance.

  3. Pass the fully resolved car instance to the DI TCK to build the full testsuite which validates the expected object relationships.

The full signature of the org.atinject.tck.Tck#testsFor(…​) method is:

     * Constructs a JUnit test suite for the given {@link Car} instance.
     * @param Car to test
     * @param supportsStatic true if the injector supports static member injection
     * @param supportsPrivate true if the injector supports private member injection
     * @throws NullPointerException if car is null
     * @throws ClassCastException if car doesn't extend {@link Convertible Convertible}
    public static Test testsFor(Car car, boolean supportsStatic,
            boolean supportsPrivate);

Configuring the DI Environment

The org.atinject.tck.Tck class defines the expected conditions that need to be configured in the DI container in order for the tests to pass:

  • is implemented by

  • is implemented by ` DriversSeat.

  • is implemented by itself, and by itself (not subclasses).

  • is implemented by

  • @jakarta.inject.Named("spare") is implemented by

  • The following classes may also be injected directly:


    • and


Static and private member injection support is optional, but if your injector supports those features, it must pass the respective tests. If static member injection is supported, the static members of the following types shall also be injected once:


  •, and


The Weld example accomplishes this by excluding inspection of certain beans via a beans.xml and with a TCKProducers class with producer methods that refine the values for the expected injection types.

Running the Example

You can run the Weld bootstrap example as follows:

Scotts-iMac:example starksm$ mvn test
[INFO] Scanning for projects...
[INFO] -------------< jakarta.inject:jakarta.inject-tck-example >--------------
[INFO] Building Jakarta Dependency Injection API TCK Example 2.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Building Jakarta Dependency Injection API TCK Example 2.0.1
[INFO] -------------------------------------------------------
[INFO] -------------------------------------------------------
[INFO] Running weld.SampleBootstrapTCK
Jun 13, 2022 7:34:10 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 5.0.0 (SP2)
Jun 13, 2022 7:34:11 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Added @Spare to [BackedAnnotatedField] @Inject
Added @Drivers to: [BackedAnnotatedType] public  class
Added @Named('spare') to: [BackedAnnotatedType] public  class
Jun 13, 2022 7:34:12 PM fireContainerInitializedEvent
INFO: WELD-ENV-002003: Weld SE container 19d8ee8b-cc7c-4131-930c-3350bb374196 initialized
[INFO] Tests run: 50, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.504 s - in weld.SampleBootstrapTCK
Weld SE container 19d8ee8b-cc7c-4131-930c-3350bb374196 shut down by shutdown hook
[INFO] Results:
[INFO] Tests run: 50, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------

Where to file challenges

Challenges and bug reports should be filed against the TCK project issue tracker at


No description, website, or topics provided.



Code of conduct





No packages published