You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/07/20 10:49:47 UTC
(camel) branch main updated: CAMEL-24181: Do not shut down shared CXF bus when stopping CxfSpringEndpoint
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 4e3c0e5c42cf CAMEL-24181: Do not shut down shared CXF bus when stopping CxfSpringEndpoint
4e3c0e5c42cf is described below
commit 4e3c0e5c42cff7cf78f37ca8b5dca83ab09a680a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jul 20 12:49:33 2026 +0200
CAMEL-24181: Do not shut down shared CXF bus when stopping CxfSpringEndpoint
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
.../cxf/spring/jaxws/CxfSpringEndpoint.java | 1 -
.../cxf/spring/CxfSpringEndpointSharedBusTest.java | 66 ++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java b/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
index c6b20c8cce5a..fa792b1abff8 100644
--- a/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
+++ b/components/camel-cxf/camel-cxf-spring-soap/src/main/java/org/apache/camel/component/cxf/spring/jaxws/CxfSpringEndpoint.java
@@ -273,7 +273,6 @@ public class CxfSpringEndpoint extends CxfEndpoint implements ApplicationContext
applicationContext = ctx;
if (bus == null) {
- createBus = true;
bus = BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx);
}
}
diff --git a/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/spring/CxfSpringEndpointSharedBusTest.java b/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/spring/CxfSpringEndpointSharedBusTest.java
new file mode 100644
index 000000000000..0ca7b45df3bd
--- /dev/null
+++ b/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/spring/CxfSpringEndpointSharedBusTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf.spring;
+
+import org.apache.camel.component.cxf.common.CXFTestSupport;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.Bus;
+import org.apache.cxf.Bus.BusState;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Verifies that stopping a CxfSpringEndpoint does not shut down the shared application-wide CXF bus.
+ */
+public class CxfSpringEndpointSharedBusTest extends AbstractSpringBeanTestSupport {
+
+ @Override
+ protected String[] getApplicationContextFiles() {
+ CXFTestSupport.getPort1();
+ return new String[] { "org/apache/camel/component/cxf/spring/CxfEndpointBeansRouter.xml" };
+ }
+
+ @Test
+ public void testStopEndpointDoesNotShutdownSharedBus() throws Exception {
+ CxfEndpoint endpoint = ctx.getBean("routerEndpoint", CxfEndpoint.class);
+ Bus bus = endpoint.getBus();
+ assertNotNull(bus);
+
+ // stopping the endpoint must not shut down the shared bus
+ endpoint.stop();
+ assertTrue(bus.getState() == BusState.RUNNING || bus.getState() == BusState.INITIAL,
+ "Shared bus must still be running after endpoint stop, but was: " + bus.getState());
+ }
+
+ @Test
+ public void testTwoEndpointsShareSameBus() throws Exception {
+ CxfEndpoint endpoint1 = ctx.getBean("routerEndpoint", CxfEndpoint.class);
+ CxfEndpoint endpoint2 = ctx.getBean("serviceEndpoint", CxfEndpoint.class);
+
+ assertSame(endpoint1.getBus(), endpoint2.getBus(),
+ "Both endpoints should share the same application bus");
+
+ // stop one endpoint — the other's bus must remain running
+ endpoint1.stop();
+ Bus sharedBus = endpoint2.getBus();
+ assertTrue(sharedBus.getState() == BusState.RUNNING || sharedBus.getState() == BusState.INITIAL,
+ "Shared bus must still be running after stopping one endpoint");
+ }
+}