Merge remote-tracking branch 'origin/master' into 3.x

Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
index 379505a..f5587aa 100644
--- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
+++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/HttpMethodEntityTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -85,7 +85,7 @@
 
     @Test
     public void testOptions() {
-        _test("OPTIONS", true, true);
+        _test("OPTIONS", true, false);
         _test("OPTIONS", false, false);
     }
 
diff --git a/tests/e2e-inject/cdi-inject-weld/pom.xml b/tests/e2e-inject/cdi-inject-weld/pom.xml
new file mode 100644
index 0000000..2289a5e
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.glassfish.jersey.tests</groupId>
+        <artifactId>e2e-inject</artifactId>
+        <version>3.1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>e2e-inject-cdi-inject-weld</artifactId>
+    <packaging>jar</packaging>
+    <name>jersey-tests-e2e-inject-cdi-inject-weld</name>
+
+    <description>Jersey E2E Inject CDI SE tests</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>jakarta.enterprise</groupId>
+            <artifactId>jakarta.enterprise.cdi-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.weld.se</groupId>
+            <artifactId>weld-se-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.incubator</groupId>
+            <artifactId>jersey-cdi-inject-weld</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-bundle</artifactId>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.glassfish.jersey.media</groupId>
+                    <artifactId>jersey-media-jaxb</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>jakarta.xml.bind</groupId>
+                    <artifactId>jakarta.xml.bind-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.test-framework</groupId>
+            <artifactId>jersey-test-framework-util</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Account.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Account.java
new file mode 100644
index 0000000..2e58abe
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Account.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.event.Observes;
+
+/**
+ * Keeps current state of money.
+ *
+ * @author Petr Bouda
+ */
+@ApplicationScoped
+public class Account {
+
+    private long current = 0;
+
+    public void observeCredit(@Observes @Credit Long amount) {
+        current += amount;
+    }
+
+    public void observeDebit(@Observes @Debit Long amount) {
+        current -= amount;
+    }
+
+    public long getCurrent() {
+        return current;
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/AccountResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/AccountResource.java
new file mode 100644
index 0000000..b09f560
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/AccountResource.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.QueryParam;
+
+import jakarta.enterprise.event.Event;
+import jakarta.inject.Inject;
+
+/**
+ * Testing resource for CDI events.
+ *
+ * @author Petr Bouda
+ */
+@Path("account")
+public class AccountResource {
+
+    @Inject
+    @Credit
+    private Event<Long> creditEvent;
+
+    @Inject
+    @Debit
+    private Event<Long> debitEvent;
+
+    @Inject
+    private Account account;
+
+    @POST
+    public void credit(@QueryParam("amount") long amount) {
+        creditEvent.fire(amount);
+    }
+
+    @DELETE
+    public void debit(@QueryParam("amount") long amount) {
+        debitEvent.fire(amount);
+    }
+
+    @GET
+    public long current() {
+        return account.getCurrent();
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Credit.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Credit.java
new file mode 100644
index 0000000..eb44bfd
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Credit.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import jakarta.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Event qualifier.
+ *
+ * @author Petr Bouda
+ */
+@Qualifier
+@Target({METHOD, FIELD, PARAMETER, TYPE})
+@Retention(RUNTIME)
+public @interface Credit {
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Debit.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Debit.java
new file mode 100644
index 0000000..e4840b0
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Debit.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import jakarta.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Event qualifier.
+ *
+ * @author Petr Bouda
+ */
+@Qualifier
+@Target({METHOD, FIELD, PARAMETER, TYPE})
+@Retention(RUNTIME)
+public @interface Debit {
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Hello.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Hello.java
new file mode 100644
index 0000000..8d9fc45
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Hello.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+/**
+ * Interface used to activate decorator.
+ *
+ * @author Petr Bouda
+ */
+public interface Hello {
+
+    String hello();
+
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloResource.java
new file mode 100644
index 0000000..80440c0
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloResource.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+
+import jakarta.inject.Inject;
+import org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources.MyBean;
+
+/**
+ * Intercepted and decorated resource.
+ *
+ * @author Petr Bouda
+ */
+@Secured
+@Path("intercepted")
+public class HelloResource implements Hello {
+
+    @Inject
+    private NameService service;
+
+    @Inject
+    MyBean mybean;
+
+    @GET
+    @Override
+    public String hello() {
+        System.out.println(mybean.hello());
+        return "Hello " + service.getName();
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloStarDecorator.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloStarDecorator.java
new file mode 100644
index 0000000..059e1b7
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/HelloStarDecorator.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.decorator.Decorator;
+import jakarta.decorator.Delegate;
+import jakarta.enterprise.inject.Any;
+import jakarta.inject.Inject;
+
+/**
+ * Decorator wraps the hello resource by stars.
+ *
+ * @author Petr Bouda
+ */
+@Decorator
+public class HelloStarDecorator implements Hello {
+
+    @Inject
+    @Delegate
+    @Any
+    Hello account;
+
+    @Override
+    public String hello() {
+        return "***" + account.hello() + "***";
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/JaxrsService.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/JaxrsService.java
new file mode 100644
index 0000000..101c924
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/JaxrsService.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.UriInfo;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * Holder for JAX-RS information to inject them into interceptor. JAX-RS does not work in interceptor.
+ *
+ * @author Petr Bouda
+ */
+@ApplicationScoped
+public class JaxrsService {
+
+    @Context
+    private UriInfo uriInfo;
+
+    public UriInfo getUriInfo() {
+        return uriInfo;
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/NameService.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/NameService.java
new file mode 100644
index 0000000..5d89196
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/NameService.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * Service returning the name.
+ *
+ * @author Petr Bouda
+ */
+@ApplicationScoped
+public class NameService {
+
+    public static final String NAME = "James";
+
+    public String getName() {
+       return NAME;
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Secured.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Secured.java
new file mode 100644
index 0000000..dc68eb1
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/Secured.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import jakarta.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Security annotation bound to {@link SecurityInterceptor}.
+ *
+ * @author Petr Bouda
+ */
+@Inherited
+@InterceptorBinding
+@Retention(RUNTIME)
+@Target({ METHOD, TYPE })
+public @interface Secured {
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/SecurityInterceptor.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/SecurityInterceptor.java
new file mode 100644
index 0000000..b6481c5
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/SecurityInterceptor.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.ForbiddenException;
+import jakarta.ws.rs.core.MultivaluedMap;
+
+import jakarta.inject.Inject;
+import jakarta.interceptor.AroundInvoke;
+import jakarta.interceptor.Interceptor;
+import jakarta.interceptor.InvocationContext;
+
+/**
+ * Interceptor checking James as a user in query params.
+ *
+ * @author Petr Bouda
+ */
+@Secured
+@Interceptor
+public class SecurityInterceptor {
+
+    @Inject
+    NameService nameService;
+
+    @Inject
+    JaxrsService jaxrsService;
+
+    @AroundInvoke
+    public Object logMethodEntry(InvocationContext ctx) throws Exception {
+        MultivaluedMap<String, String> params = jaxrsService.getUriInfo().getQueryParameters();
+        String user = params.getFirst("user");
+
+        if (nameService.getName().equals(user)) {
+            return ctx.proceed();
+        } else {
+            throw new ForbiddenException("Forbidden resource for the user: " + user);
+        }
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ApplicationCounterBean.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ApplicationCounterBean.java
new file mode 100644
index 0000000..a1f43b5
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ApplicationCounterBean.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.scopes;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+/**
+ * Request counter.
+ *
+ * @author Petr Bouda
+ */
+@ApplicationScoped
+public class ApplicationCounterBean {
+
+    private AtomicInteger counter = new AtomicInteger();
+
+    public int getNumber() {
+        return counter.incrementAndGet();
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/RequestScopedResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/RequestScopedResource.java
new file mode 100644
index 0000000..7757618
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/RequestScopedResource.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.scopes;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.UriInfo;
+
+import jakarta.inject.Inject;
+
+import org.glassfish.jersey.process.internal.RequestScoped;
+
+/**
+ * Request scoped resource.
+ *
+ * @author Petr Bouda
+ */
+@RequestScoped
+@Path("request")
+public class RequestScopedResource {
+
+    @Inject
+    private ApplicationCounterBean application;
+
+    @PathParam("name")
+    private String name;
+
+    private UriInfo uriInfo;
+
+    public RequestScopedResource(@Context UriInfo uriInfo) {
+        this.uriInfo = uriInfo;
+    }
+
+    @GET
+    @Path("{name}")
+    @Produces("text/plain")
+    public String getHello() {
+        return "Hello_" + name + " [" + application.getNumber() + "] " + "[" + uriInfo.getPath() + "] " + this;
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/SingletonScopedResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/SingletonScopedResource.java
new file mode 100644
index 0000000..0c42fd6
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/SingletonScopedResource.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.scopes;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.UriInfo;
+
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
+
+/**
+ * Singleton Resource.
+ *
+ * @author Petr Bouda
+ */
+@Singleton
+@Path("singleton")
+public class SingletonScopedResource {
+
+    @Inject
+    private ApplicationCounterBean application;
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    @Path("{name}")
+    @Produces("text/plain")
+    public String getHello(@PathParam("name") String name) {
+        return "Hello_" + name + " [" + application.getNumber() + "] " + "[" + uriInfo.getPath() + "] " + this;
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorFeature.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorFeature.java
new file mode 100644
index 0000000..b722377
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorFeature.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.container.ContainerRequestContext;
+import jakarta.ws.rs.core.Configuration;
+import jakarta.ws.rs.core.Feature;
+import jakarta.ws.rs.core.FeatureContext;
+
+import jakarta.annotation.Priority;
+import jakarta.inject.Singleton;
+
+import org.glassfish.jersey.process.Inflector;
+import org.glassfish.jersey.process.internal.RequestScoped;
+import org.glassfish.jersey.server.model.ModelProcessor;
+import org.glassfish.jersey.server.model.Resource;
+import org.glassfish.jersey.server.model.ResourceModel;
+
+@ApplicationScoped
+public class ModelProcessorFeature implements Feature {
+
+    @Override
+    public boolean configure(FeatureContext context) {
+        context.register(SimpleModelProcessor.class);
+        return true;
+    }
+
+    @Priority(5000)
+    public static class SimpleModelProcessor implements ModelProcessor {
+
+        @Override
+        public ResourceModel processResourceModel(ResourceModel resourceModel, Configuration configuration) {
+            ResourceModel.Builder builder = new ResourceModel.Builder(resourceModel.getRootResources(), false);
+            final Resource singletonResource = Resource.from(SingletonResource.class);
+            builder.addResource(singletonResource);
+
+            final Resource requestScopeResource = Resource.from(RequestScopeResource.class);
+            builder.addResource(requestScopeResource);
+
+            final Resource.Builder resourceBuilder = Resource.builder("instance");
+            resourceBuilder.addMethod("GET").handledBy(new SimpleModelProcessorInflector());
+            final Resource instanceResource = resourceBuilder.build();
+
+            builder.addResource(instanceResource);
+
+            return builder.build();
+        }
+
+        @Override
+        public ResourceModel processSubResource(ResourceModel subResource, Configuration configuration) {
+            final Resource resource = Resource.builder()
+                    .mergeWith(Resource.from(EnhancedSubResourceSingleton.class))
+                    .mergeWith(Resource.from(EnhancedSubResource.class))
+                    .mergeWith(subResource.getResources().get(0)).build();
+
+            return new ResourceModel.Builder(true).addResource(resource).build();
+        }
+
+        @Priority(5000)
+        private static class SimpleModelProcessorInflector implements Inflector<ContainerRequestContext, String> {
+            private int counter = 0;
+
+            @Override
+            public String apply(ContainerRequestContext containerRequestContext) {
+                return String.valueOf("Inflector:" + counter++);
+            }
+        }
+    }
+
+    @Singleton
+    public static class EnhancedSubResourceSingleton {
+        private int counter = 0;
+
+        @GET
+        @Path("enhanced-singleton")
+        public String get() {
+            return "EnhancedSubResourceSingleton:" + String.valueOf(counter++);
+        }
+    }
+
+    @RequestScoped
+    public static class EnhancedSubResource {
+
+        private int counter = 0;
+
+        @GET
+        @Path("enhanced")
+        public String get() {
+            return String.valueOf("EnhancedSubResource:" + counter++);
+        }
+    }
+
+    @Path("request-scope")
+    public static class RequestScopeResource {
+        private int counter = 0;
+
+        @GET
+        public String get() {
+            return String.valueOf("RequestScopeResource:" + counter++);
+        }
+    }
+
+    @Path("singleton")
+    @Singleton
+    public static class SingletonResource {
+        private int counter = 0;
+
+        @GET
+        public String get() {
+            return String.valueOf("SingletonResource:" + counter++);
+        }
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/MyBean.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/MyBean.java
new file mode 100644
index 0000000..f8c0f10
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/MyBean.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.glassfish.jersey.tests.e2e.inject.cdi.weld.Hello;
+import org.glassfish.jersey.tests.e2e.inject.cdi.weld.NameService;
+import org.glassfish.jersey.tests.e2e.inject.cdi.weld.Secured;
+
+@ApplicationScoped
+@Secured
+public class MyBean implements Hello {
+    @Inject
+    private NameService service;
+
+    public String hello() {
+        System.out.println("mybean");
+        return "Hello " + service.getName();
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootResource.java
new file mode 100644
index 0000000..53de246
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootResource.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+
+@Path("root")
+public class RootResource {
+
+    @GET
+    public String get() {
+        return "root";
+    }
+
+    @Path("sub-resource-singleton")
+    public Class<SubResourceSingleton> getSubResourceSingleton() {
+        return SubResourceSingleton.class;
+    }
+
+    @Path("sub-resource-instance")
+    public SubResourceSingleton getSubResourceSingletonInstance() {
+        return new SubResourceSingleton();
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootSingletonResource.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootSingletonResource.java
new file mode 100644
index 0000000..72dabbb
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/RootSingletonResource.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+
+import jakarta.inject.Singleton;
+
+@Path("root-singleton")
+@Singleton
+public class RootSingletonResource {
+
+    private int counter = 0;
+
+    @GET
+    public String get() {
+        return "RootSingletonResource:" + String.valueOf(counter++);
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/SubResourceSingleton.java b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/SubResourceSingleton.java
new file mode 100644
index 0000000..f4eeb69
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/SubResourceSingleton.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import jakarta.ws.rs.GET;
+
+import jakarta.inject.Singleton;
+
+@Singleton
+public class SubResourceSingleton {
+
+    private int counter = 0;
+
+    @GET
+    public String get() {
+        return String.valueOf("SubResourceSingleton:" + counter++);
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/main/resources/META-INF/beans.xml b/tests/e2e-inject/cdi-inject-weld/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..ee4acc6
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+                           http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
+       bean-discovery-mode="all">
+    <interceptors>
+        <class>org.glassfish.jersey.tests.e2e.inject.cdi.weld.SecurityInterceptor</class>
+    </interceptors>
+    <decorators>
+        <class>org.glassfish.jersey.tests.e2e.inject.cdi.weld.HelloStarDecorator</class>
+    </decorators>
+</beans>
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/EventsTest.java b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/EventsTest.java
new file mode 100644
index 0000000..3c402fe
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/EventsTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Response;
+
+import org.glassfish.jersey.inject.hk2.Hk2InjectionManagerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+
+import org.jboss.weld.environment.se.Weld;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests that the resource can fire an event.
+ *
+ * @author Petr Bouda
+ */
+public class EventsTest extends JerseyTest {
+
+    private Weld weld;
+
+    @Before
+    public void setup() {
+        Assume.assumeTrue(Hk2InjectionManagerFactory.isImmediateStrategy());
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        if (Hk2InjectionManagerFactory.isImmediateStrategy()) {
+            weld = new Weld();
+            weld.initialize();
+            super.setUp();
+        }
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        if (Hk2InjectionManagerFactory.isImmediateStrategy()) {
+            weld.shutdown();
+            super.tearDown();
+        }
+    }
+
+    @Override
+    protected Application configure() {
+        return new ResourceConfig(AccountResource.class);
+    }
+
+    @Test
+    public void testFiredEvents() {
+        Response credit = target("account").queryParam("amount", 50).request().post(Entity.json(""));
+        assertEquals(204, credit.getStatus());
+
+        Response debit = target("account").queryParam("amount", 25).request().delete();
+        assertEquals(204, debit.getStatus());
+
+        Long current = target("account").queryParam("amount", 25).request().get(Long.class);
+        assertEquals(25, current.longValue());
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/InterceptorDecoratorTest.java b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/InterceptorDecoratorTest.java
new file mode 100644
index 0000000..d52cac2
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/InterceptorDecoratorTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Response;
+
+import org.glassfish.jersey.inject.hk2.Hk2InjectionManagerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+
+import org.jboss.weld.environment.se.Weld;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests that the resource can be intercepted and decorated.
+ *
+ * @author Petr Bouda
+ */
+public class InterceptorDecoratorTest extends JerseyTest {
+
+    private Weld weld;
+
+    @Before
+    public void setup() {
+        Assume.assumeTrue(Hk2InjectionManagerFactory.isImmediateStrategy());
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        if (Hk2InjectionManagerFactory.isImmediateStrategy()) {
+            weld = new Weld();
+            weld.initialize();
+            super.setUp();
+        }
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        if (Hk2InjectionManagerFactory.isImmediateStrategy()) {
+            weld.shutdown();
+            super.tearDown();
+        }
+    }
+
+    @Override
+    protected Application configure() {
+        return new ResourceConfig(HelloResource.class);
+    }
+
+    @Test
+    public void testInterceptedGet() {
+        String intercepted = target("intercepted").queryParam("user", NameService.NAME).request().get(String.class);
+        assertEquals("***Hello James***", intercepted);
+    }
+
+    @Test
+    public void testForbiddenGet() {
+        Response result = target("intercepted").queryParam("user", "unknown").request().get();
+        assertEquals(403, result.getStatus());
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/RequestContextBuilder.java b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/RequestContextBuilder.java
new file mode 100644
index 0000000..94849a7
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/RequestContextBuilder.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import jakarta.ws.rs.WebApplicationException;
+import jakarta.ws.rs.core.Cookie;
+import jakarta.ws.rs.core.GenericEntity;
+import jakarta.ws.rs.core.GenericType;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedHashMap;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.core.SecurityContext;
+import jakarta.ws.rs.ext.WriterInterceptor;
+
+import org.glassfish.jersey.internal.MapPropertiesDelegate;
+import org.glassfish.jersey.internal.PropertiesDelegate;
+import org.glassfish.jersey.message.MessageBodyWorkers;
+import org.glassfish.jersey.message.internal.HeaderUtils;
+import org.glassfish.jersey.server.ContainerRequest;
+
+/**
+ * Used by tests to create mock JerseyContainerRequestContext instances.
+ *
+ * @author Martin Matula
+ */
+public class RequestContextBuilder {
+
+    public class TestContainerRequest extends ContainerRequest {
+
+        private Object entity;
+        private GenericType entityType;
+        private final PropertiesDelegate propertiesDelegate;
+
+        public TestContainerRequest(final URI baseUri,
+                                    final URI requestUri,
+                                    final String method,
+                                    final SecurityContext securityContext,
+                                    final PropertiesDelegate propertiesDelegate) {
+            super(baseUri, requestUri, method, securityContext, propertiesDelegate, null);
+            this.propertiesDelegate = propertiesDelegate;
+        }
+
+        public void setEntity(final Object entity) {
+            if (entity instanceof GenericEntity) {
+                this.entity = ((GenericEntity) entity).getEntity();
+                this.entityType = new GenericType(((GenericEntity) entity).getType());
+            } else {
+                this.entity = entity;
+                this.entityType = new GenericType(entity.getClass());
+            }
+        }
+
+        @Override
+        public void setWorkers(final MessageBodyWorkers workers) {
+            super.setWorkers(workers);
+            final byte[] entityBytes;
+            if (entity != null) {
+                final MultivaluedMap<String, Object> myMap = new MultivaluedHashMap<String, Object>(getHeaders());
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                OutputStream stream = null;
+                try {
+                    stream = workers.writeTo(entity, entity.getClass(), entityType.getType(),
+                            new Annotation[0], getMediaType(),
+                            myMap,
+                            propertiesDelegate, baos, Collections.<WriterInterceptor>emptyList());
+                } catch (final IOException | WebApplicationException ex) {
+                    Logger.getLogger(TestContainerRequest.class.getName()).log(Level.SEVERE, null, ex);
+                } finally {
+                    if (stream != null) {
+                        try {
+                            stream.close();
+                        } catch (final IOException e) {
+                            // ignore
+                        }
+                    }
+                }
+                entityBytes = baos.toByteArray();
+            } else {
+                entityBytes = new byte[0];
+            }
+            setEntityStream(new ByteArrayInputStream(entityBytes));
+        }
+    }
+
+    private final TestContainerRequest request;
+
+    public static RequestContextBuilder from(final String requestUri, final String method) {
+        return from(null, requestUri, method);
+    }
+
+    public static RequestContextBuilder from(final String baseUri, final String requestUri, final String method) {
+        return new RequestContextBuilder(baseUri, requestUri, method);
+    }
+
+    public static RequestContextBuilder from(final URI requestUri, final String method) {
+        return from(null, requestUri, method);
+    }
+
+    public static RequestContextBuilder from(final URI baseUri, final URI requestUri, final String method) {
+        return new RequestContextBuilder(baseUri, requestUri, method);
+    }
+
+    private RequestContextBuilder(final String baseUri, final String requestUri, final String method) {
+        this(baseUri == null || baseUri.isEmpty() ? null : URI.create(baseUri), URI.create(requestUri), method);
+    }
+
+    private RequestContextBuilder(final URI baseUri, final URI requestUri, final String method) {
+        request = new TestContainerRequest(baseUri, requestUri, method, null,
+                new MapPropertiesDelegate());
+    }
+
+    public ContainerRequest build() {
+        return request;
+    }
+
+    public RequestContextBuilder accept(final String... acceptHeader) {
+        putHeaders(HttpHeaders.ACCEPT, acceptHeader);
+        return this;
+    }
+
+    public RequestContextBuilder accept(final MediaType... acceptHeader) {
+        putHeaders(HttpHeaders.ACCEPT, (Object[]) acceptHeader);
+        return this;
+    }
+
+    public RequestContextBuilder entity(final Object entity) {
+        request.setEntity(entity);
+        return this;
+    }
+
+    public RequestContextBuilder type(final String contentType) {
+        request.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, contentType);
+        return this;
+
+    }
+
+    public RequestContextBuilder type(final MediaType contentType) {
+        request.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, HeaderUtils.asString(contentType, request.getConfiguration()));
+        return this;
+    }
+
+    public RequestContextBuilder header(final String name, final Object value) {
+        putHeader(name, value);
+        return this;
+    }
+
+    public RequestContextBuilder cookie(final Cookie cookie) {
+        putHeader(HttpHeaders.COOKIE, cookie);
+        return this;
+    }
+
+    public RequestContextBuilder cookies(final Cookie... cookies) {
+        putHeaders(HttpHeaders.COOKIE, (Object[]) cookies);
+        return this;
+    }
+
+    private void putHeader(final String name, final Object value) {
+        if (value == null) {
+            request.getHeaders().remove(name);
+            return;
+        }
+        request.header(name, HeaderUtils.asString(value, request.getConfiguration()));
+    }
+
+    private void putHeaders(final String name, final Object... values) {
+        if (values == null) {
+            request.getHeaders().remove(name);
+            return;
+        }
+        request.getHeaders().addAll(name, HeaderUtils.asStringList(Arrays.asList(values), request.getConfiguration()));
+    }
+
+    private void putHeaders(final String name, final String... values) {
+        if (values == null) {
+            request.getHeaders().remove(name);
+            return;
+        }
+        request.getHeaders().addAll(name, values);
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ScopesTest.java b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ScopesTest.java
new file mode 100644
index 0000000..9f7522b
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/scopes/ScopesTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.scopes;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+
+import org.jboss.weld.environment.se.Weld;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * Tests CDI resources.
+ */
+public class ScopesTest extends JerseyTest {
+
+    private Weld weld;
+
+    @Override
+    public void setUp() throws Exception {
+        weld = new Weld();
+        weld.initialize();
+        super.setUp();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        weld.shutdown();
+        super.tearDown();
+    }
+
+    @Override
+    protected ResourceConfig configure() {
+        return new ResourceConfig(RequestScopedResource.class, SingletonScopedResource.class);
+    }
+
+    @Test
+    public void testCheckRequest() throws InterruptedException {
+        String[] response1 = target().path("request").path("James").request().get(String.class).split(" ");
+        String[] response2 = target().path("request").path("Marcus").request().get(String.class).split(" ");
+        assertResponses("request", response1, response2);
+        assertNotEquals(response1[3], response2[3]);
+    }
+
+    @Test
+    public void testCheckSingleton() throws InterruptedException {
+        String[] response1 = target().path("singleton").path("James").request().get(String.class).split(" ");
+        String[] response2 = target().path("singleton").path("Marcus").request().get(String.class).split(" ");
+        assertResponses("singleton", response1, response2);
+        assertEquals(response1[3], response2[3]);
+    }
+
+    private void assertResponses(String type, String[] response1, String[] response2) {
+        assertEquals("Hello_James", response1[0]);
+        assertEquals("[1]", response1[1]);
+        assertEquals("[" + type + "/James]", response1[2]);
+
+        assertEquals("Hello_Marcus", response2[0]);
+        assertEquals("[2]", response2[1]);
+        assertEquals("[" + type + "/Marcus]", response2[2]);
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorScopeTest.java b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorScopeTest.java
new file mode 100644
index 0000000..a26cb29
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/java/org/glassfish/jersey/tests/e2e/inject/cdi/weld/subresources/ModelProcessorScopeTest.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.e2e.inject.cdi.weld.subresources;
+
+import java.util.concurrent.ExecutionException;
+
+import org.glassfish.jersey.server.ApplicationHandler;
+import org.glassfish.jersey.server.ContainerResponse;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.server.ServerProperties;
+import org.glassfish.jersey.tests.e2e.inject.cdi.weld.RequestContextBuilder;
+
+import org.jboss.weld.environment.se.Weld;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test scope of resources enhanced by model processors.
+ *
+ * @author Miroslav Fuksa
+ *
+ */
+public class ModelProcessorScopeTest {
+
+    private Weld weld;
+
+    @Before
+    public void setUp() throws Exception {
+        weld = new Weld();
+        weld.initialize();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        weld.shutdown();
+    }
+
+    private void _testCounter(ApplicationHandler applicationHandler, String requestUri, final String prefix,
+                              final String expectedSecondHit) throws
+            InterruptedException, ExecutionException {
+        ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from(requestUri,
+                "GET").build()).get();
+        assertEquals(200, response.getStatus());
+        assertEquals(prefix + ":0", response.getEntity());
+        response = applicationHandler.apply(RequestContextBuilder.from(requestUri,
+                "GET").build()).get();
+        assertEquals(prefix + ":" + expectedSecondHit, response.getEntity());
+    }
+
+    @Test
+    public void testSingleton() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(ModelProcessorFeature
+                .SingletonResource.class));
+        final String requestUri = "/singleton";
+        _testCounter(applicationHandler, requestUri, "SingletonResource", "1");
+    }
+
+    @Test
+    public void testSingletonInModelProcessor() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class,
+                ModelProcessorFeature.class));
+        final String requestUri = "/singleton";
+        _testCounter(applicationHandler, requestUri, "SingletonResource", "1");
+    }
+
+    @Test
+    public void testSubResourceSingletonInOriginalModel() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class));
+        final String requestUri = "/root/sub-resource-singleton";
+        _testCounter(applicationHandler, requestUri, "SubResourceSingleton", "1");
+    }
+
+    @Test
+    public void testSubResourceEnhancedSingleton() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class));
+        final String requestUri = "/root/sub-resource-singleton/enhanced-singleton";
+        _testCounter(applicationHandler, requestUri, "EnhancedSubResourceSingleton", "1");
+    }
+
+    @Test
+    public void testSubResourceInstanceEnhancedSingleton() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class));
+        final String requestUri = "/root/sub-resource-instance/enhanced-singleton";
+        _testCounter(applicationHandler, requestUri, "EnhancedSubResourceSingleton", "1");
+    }
+
+    @Test
+    public void testSubResourceInstanceEnhancedSubResource() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class));
+        final String requestUri = "/root/sub-resource-instance/enhanced";
+        _testCounter(applicationHandler, requestUri, "EnhancedSubResource", "0");
+    }
+
+    @Test
+    public void testSubResourceEnhancedSubResource() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class));
+        final String requestUri = "/root/sub-resource-singleton/enhanced";
+        _testCounter(applicationHandler, requestUri, "EnhancedSubResource", "0");
+    }
+
+    @Test
+    public void testInstanceInModelProcessor() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class,
+                ModelProcessorFeature.class));
+        final String requestUri = "/instance";
+        _testCounter(applicationHandler, requestUri, "Inflector", "1");
+    }
+
+    @Test
+    public void testRootSingleton() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class,
+                RootSingletonResource.class));
+        final String requestUri = "/root-singleton";
+        _testCounter(applicationHandler, requestUri, "RootSingletonResource", "1");
+    }
+
+    @Test
+    public void testRequestScopeResource() throws ExecutionException, InterruptedException {
+        ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(RootResource.class,
+                RootSingletonResource.class, ModelProcessorFeature.class));
+        final String requestUri = "/request-scope";
+        _testCounter(applicationHandler, requestUri, "RequestScopeResource", "0");
+    }
+}
diff --git a/tests/e2e-inject/cdi-inject-weld/src/test/resources/surefire.policy b/tests/e2e-inject/cdi-inject-weld/src/test/resources/surefire.policy
new file mode 100644
index 0000000..a6cc723
--- /dev/null
+++ b/tests/e2e-inject/cdi-inject-weld/src/test/resources/surefire.policy
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+// we do not care about java lib itself
+grant codebase "file:${java.home}/-" {
+  permission java.security.AllPermission;
+};
+
+// we do not care about our dependencies
+grant codebase "file:${settings.localRepository}/-" {
+  permission java.security.AllPermission;
+};
+
+// this is to be able to set runtime delegate instance in jax-rs from the tests
+// and to run multi-threaded tests
+grant codebase "file:${project.build.directory}/test-classes/-" {
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+  permission java.lang.RuntimePermission "modifyThread";
+  permission java.util.PropertyPermission "*", "write";
+  permission java.lang.RuntimePermission "getClassLoader";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.misc.*";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+};
+
+grant codebase "file:${project.build.directory}/classes/-" {
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.RuntimePermission "getClassLoader";
+  permission java.lang.RuntimePermission "modifyThread";
+  permission java.util.PropertyPermission "*", "read";
+  permission java.io.FilePermission "<<ALL FILES>>", "read";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.misc.*";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+};
diff --git a/tests/e2e-inject/pom.xml b/tests/e2e-inject/pom.xml
index 5faf994..d24ac03 100644
--- a/tests/e2e-inject/pom.xml
+++ b/tests/e2e-inject/pom.xml
@@ -34,6 +34,7 @@
 
     <modules>
         <module>cdi2-se</module>
+        <module>cdi-inject-weld</module>
         <module>hk2</module>
     </modules>
 </project>
diff --git a/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/ApplicationCachingTest.java b/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/ApplicationCachingTest.java
new file mode 100644
index 0000000..c98d227
--- /dev/null
+++ b/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/ApplicationCachingTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.api;
+
+import org.glassfish.jersey.server.ServerProperties;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.container.ContainerRequestContext;
+import jakarta.ws.rs.container.ContainerRequestFilter;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Response;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class ApplicationCachingTest extends JerseyTest {
+
+    private static AtomicInteger singletonCounter = new AtomicInteger(0);
+
+    public static class ApplicationCachingTestFilter implements ContainerRequestFilter {
+        @Override
+        public void filter(ContainerRequestContext requestContext) throws IOException {
+
+        }
+    }
+
+    @Path("/")
+    public static class ApplicationCachingTestResource {
+        @GET
+        public String get() {
+            return "GET";
+        }
+    }
+
+    public static class OneTimeCalledApplication extends Application {
+        @Override
+        public Map<String, Object> getProperties() {
+            Map<String, Object> map = new HashMap<>();
+            map.put(ServerProperties.WADL_FEATURE_DISABLE, true);
+            return map;
+        }
+
+        @Override
+        public Set<Object> getSingletons() {
+            singletonCounter.incrementAndGet();
+            return Collections.singleton(new ApplicationCachingTestFilter());
+        }
+
+        @Override
+        public Set<Class<?>> getClasses() {
+            return Collections.singleton(ApplicationCachingTestResource.class);
+        }
+    }
+
+    @Override
+    protected Application configure() {
+        return new OneTimeCalledApplication();
+    }
+
+    @Test
+    public void testOneTimeCalled() {
+        try (Response r = target().request().get()) {
+            Assert.assertEquals(200, r.getStatus());
+        }
+        Assert.assertEquals(1, singletonCounter.get());
+    }
+}
diff --git a/tests/integration/cdi-integration/context-inject-on-server/pom.xml b/tests/integration/cdi-integration/context-inject-on-server/pom.xml
index db43dcc..856a3ee 100644
--- a/tests/integration/cdi-integration/context-inject-on-server/pom.xml
+++ b/tests/integration/cdi-integration/context-inject-on-server/pom.xml
@@ -57,24 +57,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.glassfish.jersey.ext.cdi</groupId>
-            <artifactId>jersey-weld2-se</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.jboss.weld.se</groupId>
             <artifactId>weld-se-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.ext.cdi</groupId>
-            <artifactId>jersey-cdi1x</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.ext.cdi</groupId>
-            <artifactId>jersey-cdi-rs-inject</artifactId>
-        </dependency>
-        <dependency>
+       <dependency>
             <groupId>org.glassfish.jersey.media</groupId>
             <artifactId>jersey-media-sse</artifactId>
         </dependency>
@@ -83,4 +70,54 @@
             <artifactId>jersey-container-servlet-core</artifactId>
         </dependency>
     </dependencies>
+    <profiles>
+        <profile>
+            <id>DefaultInject</id>
+            <activation>
+                <property><name>!cdiInject</name></property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                    <artifactId>jersey-weld2-se</artifactId>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                    <artifactId>jersey-cdi1x</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                    <artifactId>jersey-cdi-rs-inject</artifactId>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>CdiInjectWeld</id>
+            <activation>
+                <property><name>cdiInject</name></property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.glassfish.jersey.incubator</groupId>
+                    <artifactId>jersey-cdi-inject-weld</artifactId>
+                    <version>${project.version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <testIncludes>
+                                <testInclude>org/glassfish/jersey/tests/cdi/inject/ScopedInjectionTest.java</testInclude>
+                            </testIncludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
diff --git a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ApplicationInjectParent.java b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ApplicationInjectParent.java
index 25e2038..f3b9cd5 100644
--- a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ApplicationInjectParent.java
+++ b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ApplicationInjectParent.java
@@ -51,11 +51,11 @@
     @Inject
     protected HttpHeaders injectHttpHeaders;
 
-    @Context
-    ParamConverterProvider contextParamConverterProvider;
-
-    @Inject
-    ParamConverterProvider injectParamConverterProvider;
+//    @Context
+//    ParamConverterProvider contextParamConverterProvider;
+//
+//    @Inject
+//    ParamConverterProvider injectParamConverterProvider;
 
     @Context
     protected Providers contextProviders;
diff --git a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerRequestFilter.java b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerRequestFilter.java
index 34b7d8a..7995347 100644
--- a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerRequestFilter.java
+++ b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerRequestFilter.java
@@ -28,11 +28,11 @@
         StringBuilder stringBuilder = new StringBuilder();
         boolean injected = false;
 
-        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("injected")) {
+        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("inject")) {
             injected = checkInjected(stringBuilder);
         }
 
-        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("contexted")) {
+        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("context")) {
             injected = checkContexted(stringBuilder);
         }
 
diff --git a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerResponseFilter.java b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerResponseFilter.java
index 8443b86..7e9c596 100644
--- a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerResponseFilter.java
+++ b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentContainerResponseFilter.java
@@ -28,11 +28,11 @@
         StringBuilder stringBuilder = new StringBuilder();
         boolean injected = false;
 
-        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("injected")) {
+        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("inject")) {
             injected = checkInjected(stringBuilder);
         }
 
-        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("contexted")) {
+        if (requestContext.getUriInfo().getRequestUri().toASCIIString().contains("context")) {
             injected = checkContexted(stringBuilder);
         }
 
diff --git a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentInject.java b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentInject.java
index ec39b45..c774e86 100644
--- a/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentInject.java
+++ b/tests/integration/cdi-integration/context-inject-on-server/src/main/java/org/glassfish/jersey/tests/cdi/inject/ParentInject.java
@@ -55,11 +55,11 @@
     @Inject
     protected HttpHeaders injectHttpHeaders;
 
-    @Context
-    protected ParamConverterProvider contextParamConverterProvider;
-
-    @Inject
-    protected ParamConverterProvider injectParamConverterProvider;
+//    @Context
+//    protected ParamConverterProvider contextParamConverterProvider;
+//
+//    @Inject
+//    protected ParamConverterProvider injectParamConverterProvider;
 
     @Context
     protected PropertiesDelegate contextPropertiesDelegate;
@@ -140,7 +140,7 @@
         injected &= checkConfiguration(injectConfiguration, stringBuilder);
         injected &= InjectionChecker.checkHttpHeaders(injectHttpHeaders, stringBuilder);
         injected &= checkPropertiesDelegate(injectPropertiesDelegate, stringBuilder);
-        injected &= InjectionChecker.checkParamConverterProvider(injectParamConverterProvider, stringBuilder);
+//        injected &= InjectionChecker.checkParamConverterProvider(injectParamConverterProvider, stringBuilder);
         injected &= InjectionChecker.checkProviders(injectProviders, stringBuilder);
         injected &= InjectionChecker.checkRequest(injectRequest, stringBuilder);
         injected &= InjectionChecker.checkResourceContext(injectResourceContext, stringBuilder);
@@ -163,7 +163,7 @@
         injected &= checkApplication(contextApplication, stringBuilder);
         injected &= checkConfiguration(contextConfiguration, stringBuilder);
         injected &= InjectionChecker.checkHttpHeaders(contextHttpHeaders, stringBuilder);
-        injected &= InjectionChecker.checkParamConverterProvider(contextParamConverterProvider, stringBuilder);
+//        injected &= InjectionChecker.checkParamConverterProvider(contextParamConverterProvider, stringBuilder);
         injected &= checkPropertiesDelegate(contextPropertiesDelegate, stringBuilder);
         injected &= InjectionChecker.checkProviders(contextProviders, stringBuilder);
         injected &= InjectionChecker.checkRequest(contextRequest, stringBuilder);
diff --git a/tests/integration/j-441/war1/pom.xml b/tests/integration/j-441/war1/pom.xml
index 4f93886..7b165bc 100644
--- a/tests/integration/j-441/war1/pom.xml
+++ b/tests/integration/j-441/war1/pom.xml
@@ -40,9 +40,9 @@
         </dependency>
 
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>${servlet3.version}</version>
+            <groupId>jakarta.servlet</groupId>
+            <artifactId>jakarta.servlet-api</artifactId>
+            <version>${servlet5.version}</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CdiResource.java b/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CdiResource.java
index ea0f0af..12e0ee9 100644
--- a/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CdiResource.java
+++ b/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CdiResource.java
@@ -22,7 +22,7 @@
 
 import jakarta.enterprise.context.RequestScoped;
 import jakarta.inject.Inject;
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
 
 /**
  * CDI backed JAX-RS resource.
diff --git a/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CustomExceptionMapper.java b/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CustomExceptionMapper.java
index 7d7ae6c..1e7bf1b 100644
--- a/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CustomExceptionMapper.java
+++ b/tests/integration/j-441/war1/src/main/java/org/glassfish/jersey/tests/integration/j441/one/CustomExceptionMapper.java
@@ -20,7 +20,7 @@
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.ext.ExceptionMapper;
 
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
 
 /**
  * JAX-RS provider added just to make sure the application
diff --git a/tests/integration/j-441/war2/pom.xml b/tests/integration/j-441/war2/pom.xml
index a08e17d..58cad9b 100644
--- a/tests/integration/j-441/war2/pom.xml
+++ b/tests/integration/j-441/war2/pom.xml
@@ -40,9 +40,9 @@
         </dependency>
 
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>${servlet3.version}</version>
+            <groupId>jakarta.servlet</groupId>
+            <artifactId>jakarta.servlet-api</artifactId>
+            <version>${servlet5.version}</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CdiResource.java b/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CdiResource.java
index 9135e2b..a57782d 100644
--- a/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CdiResource.java
+++ b/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CdiResource.java
@@ -22,7 +22,7 @@
 
 import jakarta.enterprise.context.RequestScoped;
 import jakarta.inject.Inject;
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
 
 /**
  * CDI backed JAX-RS resource.
diff --git a/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CustomExceptionMapper.java b/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CustomExceptionMapper.java
index a6c2329..3dc67a6 100644
--- a/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CustomExceptionMapper.java
+++ b/tests/integration/j-441/war2/src/main/java/org/glassfish/jersey/tests/integration/j441/two/CustomExceptionMapper.java
@@ -20,7 +20,7 @@
 import jakarta.ws.rs.core.Response;
 import jakarta.ws.rs.ext.ExceptionMapper;
 
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
 
 /**
  * JAX-RS provider added just to make sure the application
diff --git a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SendErrorApp.java b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SendErrorApp.java
index 41c46de..53ca64e 100644
--- a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SendErrorApp.java
+++ b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SendErrorApp.java
@@ -20,7 +20,7 @@
 
 /**
  * Configure {@link org.glassfish.jersey.server.ServerProperties#RESPONSE_SET_STATUS_OVER_SEND_ERROR} by {@code true} -
- * method {@link javax.servlet.http.HttpServletResponse#sendError} will be called in case of errors
+ * method {@link jakarta.servlet.http.HttpServletResponse#sendError} will be called in case of errors
  * (status {@code 4xx} or {@code 5xx}).
  *
  * @author Libor Kramolis
diff --git a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SetStatusApp.java b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SetStatusApp.java
index d4a5070..65837be 100644
--- a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SetStatusApp.java
+++ b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/Jersey2176SetStatusApp.java
@@ -20,7 +20,7 @@
 
 /**
  * Configure {@link org.glassfish.jersey.server.ServerProperties#RESPONSE_SET_STATUS_OVER_SEND_ERROR} by {@code true} -
- * method {@link javax.servlet.http.HttpServletResponse#setStatus} will be called in case of errors
+ * method {@link jakarta.servlet.http.HttpServletResponse#setStatus} will be called in case of errors
  * (status {@code 4xx} or {@code 5xx}).
  *
  * @author Libor Kramolis
diff --git a/tests/integration/jersey-3662/pom.xml b/tests/integration/jersey-3662/pom.xml
new file mode 100644
index 0000000..a24a114
--- /dev/null
+++ b/tests/integration/jersey-3662/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>project</artifactId>
+        <groupId>org.glassfish.jersey.tests.integration</groupId>
+        <version>3.1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <description>
+        Reproducer of JERSEY-3662
+    </description>
+
+    <artifactId>jersey-3662</artifactId>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/tests/integration/jersey-3662/src/test/java/org/glassfish/jersey/tests/integration/jersey3662/Junit5Test.java b/tests/integration/jersey-3662/src/test/java/org/glassfish/jersey/tests/integration/jersey3662/Junit5Test.java
new file mode 100644
index 0000000..c971a46
--- /dev/null
+++ b/tests/integration/jersey-3662/src/test/java/org/glassfish/jersey/tests/integration/jersey3662/Junit5Test.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.integration.jersey3662;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Response;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
+import org.junit.jupiter.api.Test;
+
+public class Junit5Test extends JerseyTest {
+
+    @Path("test")
+    public static class TestResource {
+        @GET
+        public String get() {
+            return "test";
+        }
+    }
+
+    @Override
+    protected Application configure() {
+        return new ResourceConfig(TestResource.class);
+    }
+
+    @Test
+    public void success() {
+        Response response = target().path("test").request().get();
+        assertEquals(200, response.getStatus());
+        assertEquals("test", response.readEntity(String.class));
+    }
+
+}
diff --git a/tests/integration/microprofile/rest-client14-compatibility/src/test/java/org/glassfish/jersey/tests/restclient/compatibility/Compatibility14Test.java b/tests/integration/microprofile/rest-client14-compatibility/src/test/java/org/glassfish/jersey/tests/restclient/compatibility/Compatibility14Test.java
index 8507722..16476e8 100644
--- a/tests/integration/microprofile/rest-client14-compatibility/src/test/java/org/glassfish/jersey/tests/restclient/compatibility/Compatibility14Test.java
+++ b/tests/integration/microprofile/rest-client14-compatibility/src/test/java/org/glassfish/jersey/tests/restclient/compatibility/Compatibility14Test.java
@@ -29,12 +29,12 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Response;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.core.Application;
+import jakarta.ws.rs.core.Response;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 
diff --git a/tests/integration/pom.xml b/tests/integration/pom.xml
index 19415ed..f22cfaa 100644
--- a/tests/integration/pom.xml
+++ b/tests/integration/pom.xml
@@ -47,6 +47,8 @@
         <module>jersey-2154</module>
         <module>jersey-2421</module>
         <module>jersey-2776</module>
+        <module>jersey-3662</module>
+        <module>jersey-3796</module>
         <module>jersey-3670</module>
         <module>jersey-3992</module>
         <module>jersey-4003</module>
diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
index 4d7ea88..bd10b50 100644
--- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
+++ b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
@@ -27,7 +27,7 @@
 
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
index 8b99e62..e79d9bd 100644
--- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
+++ b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
@@ -20,7 +20,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
index ee08a25..0e5d2cf 100644
--- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
+++ b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
@@ -27,7 +27,7 @@
 
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
index 4d7ea88..bd10b50 100644
--- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
+++ b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java
@@ -27,7 +27,7 @@
 
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
index 022cf1a..b7fb876 100644
--- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
+++ b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java
@@ -20,7 +20,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
index ee08a25..0e5d2cf 100644
--- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
+++ b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java
@@ -27,7 +27,7 @@
 
 import jakarta.inject.Inject;
 import jakarta.inject.Named;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
diff --git a/tests/osgi/functional/pom.xml b/tests/osgi/functional/pom.xml
index b815e69..141c090 100644
--- a/tests/osgi/functional/pom.xml
+++ b/tests/osgi/functional/pom.xml
@@ -121,6 +121,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.cm</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
             <scope>test</scope>
diff --git a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/ApacheOsgiIntegrationTest.java b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/ApacheOsgiIntegrationTest.java
index c512708..2914dbb 100644
--- a/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/ApacheOsgiIntegrationTest.java
+++ b/tests/osgi/functional/src/test/java/org/glassfish/jersey/osgi/test/basic/ApacheOsgiIntegrationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at