This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/main by this push:
     new bbfd0054ff TOMEE-4728 - deploy the container health application 
without the providers of declared applications (#3064)
bbfd0054ff is described below

commit bbfd0054ff57fa91b29983c089c007461bde8d20
Author: Markus Jung <[email protected]>
AuthorDate: Wed Oct 7 17:37:13 2026 +0200

    TOMEE-4728 - deploy the container health application without the providers 
of declared applications (#3064)
---
 .../microprofile/health/HealthEndpointTest.java    | 31 ++++++++++++++++++++++
 .../apache/openejb/server/rest/RESTService.java    |  4 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git 
a/itests/tomee-microprofile-itests/src/test/java/org/apache/tomee/microprofile/health/HealthEndpointTest.java
 
b/itests/tomee-microprofile-itests/src/test/java/org/apache/tomee/microprofile/health/HealthEndpointTest.java
index eb5fa1c085..2f699403d0 100644
--- 
a/itests/tomee-microprofile-itests/src/test/java/org/apache/tomee/microprofile/health/HealthEndpointTest.java
+++ 
b/itests/tomee-microprofile-itests/src/test/java/org/apache/tomee/microprofile/health/HealthEndpointTest.java
@@ -22,6 +22,7 @@ import jakarta.ws.rs.NameBinding;
 import jakarta.ws.rs.Path;
 import jakarta.ws.rs.container.ContainerRequestContext;
 import jakarta.ws.rs.container.ContainerRequestFilter;
+import jakarta.ws.rs.container.PreMatching;
 import jakarta.ws.rs.core.Application;
 import jakarta.ws.rs.core.Response;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -125,6 +126,20 @@ public class HealthEndpointTest {
         assertEquals(200, get(tomee, "/test/health/live").getStatus());
     }
 
+    @Test
+    public void applicationWithItsOwnProvider() throws Exception {
+        final TomEE tomee = deploy(Archive.archive()
+                                          .add(HealthEndpointTest.class)
+                                          .add(UnavailableApp.class)
+                                          .add(UnavailableFilter.class)
+                                          .add(HelloResource.class)
+                                          .asJar());
+
+        assertEquals(503, get(tomee, "/test/api/hello").getStatus());
+        assertEquals(200, get(tomee, "/test/health").getStatus());
+        assertEquals(200, get(tomee, "/test/health/live").getStatus());
+    }
+
     private static TomEE deploy(final File appJar) throws Exception {
         return TomEE.microprofile()
                     .add("webapps/test/WEB-INF/beans.xml", "")
@@ -183,6 +198,22 @@ public class HealthEndpointTest {
         }
     }
 
+    @ApplicationPath("/api")
+    public static class UnavailableApp extends Application {
+        @Override
+        public Set<Class<?>> getClasses() {
+            return Set.of(HelloResource.class, UnavailableFilter.class);
+        }
+    }
+
+    @PreMatching
+    public static class UnavailableFilter implements ContainerRequestFilter {
+        @Override
+        public void filter(final ContainerRequestContext requestContext) {
+            
requestContext.abortWith(Response.status(Response.Status.SERVICE_UNAVAILABLE).build());
+        }
+    }
+
     @ApplicationPath("/other")
     public static class OtherApp extends Application {
         @Override
diff --git 
a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
 
b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
index a4310d3d96..770c01d46d 100644
--- 
a/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
+++ 
b/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
@@ -154,6 +154,8 @@ public abstract class RESTService implements ServerService, 
SelfManaging {
 
         final Collection<Object> additionalProviders = new HashSet<>();
         addAppProvidersIfNeeded(appInfo, webApp, classLoader, 
additionalProviders);
+        // the providers of the webapp itself, before the declared 
applications add their own
+        final Collection<Object> webAppProviders = new 
HashSet<>(additionalProviders);
 
         Collection<IdPropertiesInfo> pojoConfigurations = null; // done lazily
         try {
@@ -275,7 +277,7 @@ public abstract class RESTService implements ServerService, 
SelfManaging {
 
                 if (!webApp.restApplications.isEmpty() && 
deploymentWithApplication && !applicationAtContextRoot && 
!containerResources.isEmpty()) {
                     pojoConfigurations = 
PojoUtil.findPojoConfig(pojoConfigurations, appInfo, webApp);
-                    deployApplication(appInfo, webApp.contextRoot, restEjbs, 
classLoader, injections, owbCtx, context, additionalProviders, 
pojoConfigurations, new InternalApplication(null), containerResources, "/" + 
wildcard);
+                    deployApplication(appInfo, webApp.contextRoot, restEjbs, 
classLoader, injections, owbCtx, context, webAppProviders, pojoConfigurations, 
new InternalApplication(null), containerResources, "/" + wildcard);
                 }
 
                 if (webApp.restApplications.isEmpty()) {

Reply via email to