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

davsclaus pushed a commit to branch CAMEL-22066-remove-spring-blueprint-xml
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3d427e034d874197a26b6434881752da643acb91
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Dec 2 22:36:09 2026 +0100

    CAMEL-22066: camel-xml-io-dsl - Remove loading legacy Spring <beans> and 
OSGi <blueprint> XML
    
    The support was deprecated in 4.22. Loading a legacy Spring XML <beans> 
file, an OSGi
    <blueprint> file, Spring Beans XML inside <camel>, or a Spring/Blueprint 
<camelContext>
    inside <camel> now fails with a message that explains how to migrate.
    
    - Remove BeansDefinition.springOrBlueprintBeans and regenerate the XML 
parser and writer.
    - Remove SpringXmlBeansHandler and BlueprintXmlBeansHandler from 
camel-kamelet-main.
    - camel-kamelet-main no longer depends on spring-context (test scope only); 
the Spring
      annotations for dependency injection are downloaded on demand.
    - Docs and the 4.25 upgrade guide.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../apache/camel/catalog/docs/java-xml-io-dsl.adoc |  47 +-
 .../apache/camel/model/app/BeansDefinition.java    |  34 --
 .../org/apache/camel/main/BaseMainSupport.java     |   2 +-
 .../java/org/apache/camel/xml/in/ModelParser.java  |  20 +-
 .../java/org/apache/camel/xml/out/ModelWriter.java |   1 -
 .../org/apache/camel/xml/in/ModelParserTest.java   |  33 +-
 .../src/test/resources/beansWithSpringNS.xml       |   4 +-
 design/security.adoc                               |   4 +-
 .../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc    |  57 +++
 .../modules/ROOT/pages/camel-jbang-beans.adoc      |  64 +--
 .../modules/ROOT/pages/security-policy.adoc        |   8 +-
 .../dsl/jbang/core/commands/TransformTest.java     |  18 -
 .../src/test/resources/blueprint-out.yaml          |  41 --
 .../src/test/resources/blueprint.xml               |  41 --
 dsl/camel-kamelet-main/pom.xml                     |   7 +-
 .../java/org/apache/camel/main/KameletMain.java    |  42 --
 .../xml/blueprint/BlueprintXmlBeansHandler.java    | 543 ---------------------
 .../main/xml/spring/SpringXmlBeansHandler.java     | 340 -------------
 .../main/KameletMainSecurityPolicyBeansTest.java   |  78 ---
 .../org/apache/camel/main/KameletMainTest.java     |  88 ----
 .../java/org/apache/camel/main/app/Greeter.java    |  62 ---
 .../org/apache/camel/main/app/GreeterMessage.java  |  31 --
 .../org/apache/camel/main/app/MyTlsClient.java     |  30 --
 .../camel/main/xml/blueprint-security-policy.xml   |  33 --
 .../org/apache/camel/main/xml/spring-camel1.xml    |  57 ---
 .../org/apache/camel/main/xml/spring-camel2.xml    |  44 --
 .../src/main/docs/java-xml-io-dsl.adoc             |  47 +-
 .../apache/camel/dsl/xml/io/XmlModelParser.java    |  80 +--
 .../camel/dsl/xml/io/XmlRoutesBuilderLoader.java   |  48 +-
 .../camel/dsl/xml/io/XmlBlueprintLoadTest.java     |  59 ---
 .../camel/dsl/xml/io/XmlLegacyBeansLoadTest.java   |  72 +++
 .../apache/camel/dsl/xml/io/XmlLoadAppTest.java    |  21 -
 .../camel/dsl/xml/io/XmlSpringBeansLoadTest.java   |  41 --
 .../org/apache/camel/dsl/xml/io/blueprintRests.xml |  68 ---
 .../{blueprintRoutes.xml => legacy-blueprint.xml}  |   0
 .../{camel-app14.xml => legacy-camel-context.xml}  |   4 +-
 .../dsl/xml/io/legacy-spring-beans-in-camel.xml}   |  10 +-
 .../{springBeans.xml => legacy-spring-beans.xml}   |   0
 .../src/main/resources/velocity/model-parser.vm    |   5 +-
 39 files changed, 234 insertions(+), 1950 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/java-xml-io-dsl.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/java-xml-io-dsl.adoc
index b802837e6897..5eea60906d0b 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/java-xml-io-dsl.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/java-xml-io-dsl.adoc
@@ -72,48 +72,15 @@ It is now possible with `xml-io-dsl` to declare some beans 
to be bound to xref:m
 </camel>
 ----
 
-=== Loading Spring XML files with embedded beans
+=== Legacy Spring XML and OSGi Blueprint files
 
-**Deprecated**
+Legacy Spring XML `<beans>` files and OSGi `<blueprint>` files are not 
supported (removed in Camel 4.25), and neither
+are Spring Beans XML elements (`<beans 
xmlns="http://www.springframework.org/schema/beans";>`) inside Camel XML DSL
+files. Loading such a file fails with an error that explains how to migrate.
 
-While keeping all the benefits of fast XML parser used by `xml-io-dsl`, Camel 
can also process XML elements declared in other XML namespaces and process them 
separately. With this mechanism it is possible to include XML elements using 
Spring's `http://www.springframework.org/schema/beans` namespace.
-
-This brings the flexibility of Spring Beans into 
xref:components:others:main.adoc[Camel Main] without actually running any 
Spring Application Context (or Spring Boot). When elements from Spring 
namespace are found, they are used to populate and configure an instance of 
`org.springframework.beans.factory.support.DefaultListableBeanFactory` and 
leverage Spring dependency injection to wire the beans together. These beans 
are then exposed through normal xref:manual::registry.adoc[Camel Regis [...]
-
-Here's an example `camel.xml` file, which defines both the routes and beans 
used (referred to) by the route definition:
-
-.camel.xml
-[source,xml]
-----
-<camel>
-
-    <beans xmlns="http://www.springframework.org/schema/beans";>
-        <bean id="messageString" class="java.lang.String">
-            <constructor-arg index="0" value="Hello"/>
-        </bean>
-
-        <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-            <description>Spring Bean</description>
-            <property name="message">
-                <bean class="org.apache.camel.main.app.GreeterMessage">
-                    <property name="msg" ref="messageString"/>
-                </bean>
-            </property>
-        </bean>
-    </beans>
-
-    <route id="my-route">
-        <from uri="direct:start"/>
-        <bean ref="greeter"/>
-        <to uri="mock:finish"/>
-    </route>
-
-</camel>
-----
-
-A `my-route` route is referring to `greeter` bean which is defined using 
Spring `<bean>` element.
-
-More examples can be found in 
xref:manual:ROOT:camel-jbang-beans.adoc#_using_spring_beans_xml_in_camel_xml_dsl[Camel
 CLI] page.
+Declare the beans with Camel's own `<bean>` elements as shown above, or use 
xref:components:others:spring-xml.adoc[Spring XML]
+(`camel-spring-xml`) to run Spring XML files with Spring. See the
+xref:manual:ROOT:camel-4x-upgrade-guide-4_25.adoc[Camel 4.25 upgrade guide] 
for how to migrate.
 
 === Using bean with constructors
 
diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/app/BeansDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/app/BeansDefinition.java
index 6643d11f6eb3..aef26011c2f7 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/app/BeansDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/app/BeansDefinition.java
@@ -21,14 +21,11 @@ import java.util.List;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAnyElement;
 import jakarta.xml.bind.annotation.XmlElement;
 import jakarta.xml.bind.annotation.XmlElementWrapper;
 import jakarta.xml.bind.annotation.XmlRootElement;
 import jakarta.xml.bind.annotation.XmlType;
 
-import org.w3c.dom.Element;
-
 import jdk.jfr.Description;
 import org.apache.camel.model.BeanFactoryDefinition;
 import org.apache.camel.model.DataFormatDefinition;
@@ -40,7 +37,6 @@ import 
org.apache.camel.model.rest.RestConfigurationDefinition;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.DslProperty;
-import org.apache.camel.spi.annotations.ExternalSchemaElement;
 
 /**
  * Container for beans, routes, and more.
@@ -54,7 +50,6 @@ import org.apache.camel.spi.annotations.ExternalSchemaElement;
 @XmlType(propOrder = {
         "componentScanning",
         "beans",
-        "springOrBlueprintBeans",
         "sslContextParameters",
         "dataFormats",
         "restConfigurations",
@@ -79,17 +74,6 @@ public class BeansDefinition {
     @Metadata(description = "List of bean definitions to be registered in the 
Camel registry.")
     private List<BeanFactoryDefinition> beans = new ArrayList<>();
 
-    // support for legacy spring <beans> and blueprint <bean> files to be 
parsed and loaded
-    // for migration and tooling effort (need to be in a single @XmlAnyElement 
as otherwise
-    // this causes camel-spring-xml to generate an invalid XSD
-    @ExternalSchemaElement(names = { "beans", "bean", "alias" }, names2 = 
"bean",
-                           namespace = 
"http://www.springframework.org/schema/beans";,
-                           namespace2 = 
"http://www.osgi.org/xmlns/blueprint/v1.0.0";,
-                           documentElement = "beans",
-                           documentElement2 = "blueprint")
-    @XmlAnyElement
-    private List<Element> springOrBlueprintBeans = new ArrayList<>();
-
     // the order comes from <camelContext> 
(org.apache.camel.spring.xml.CamelContextFactoryBean)
     // to make things less confusing, as it's not easy to simply tell JAXB to 
use <xsd:choice maxOccurs="unbounded">
     // over a set of unrelated elements
@@ -142,24 +126,6 @@ public class BeansDefinition {
         this.beans = beans;
     }
 
-    /**
-     * @deprecated use standard Camel XML DSL (camel-xml-io) instead of legacy 
Spring/Blueprint XML. This feature will
-     *             be removed in a future release.
-     */
-    @Deprecated(since = "4.22")
-    public List<Element> getSpringOrBlueprintBeans() {
-        return springOrBlueprintBeans;
-    }
-
-    /**
-     * @deprecated use standard Camel XML DSL (camel-xml-io) instead of legacy 
Spring/Blueprint XML. This feature will
-     *             be removed in a future release.
-     */
-    @Deprecated(since = "4.22")
-    public void setSpringOrBlueprintBeans(List<Element> 
springOrBlueprintBeans) {
-        this.springOrBlueprintBeans = springOrBlueprintBeans;
-    }
-
     public List<SSLContextParametersDefinition> getSslContextParameters() {
         return sslContextParameters;
     }
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java 
b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index c5161fc004e5..4197c9860f9f 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -1188,7 +1188,7 @@ public abstract class BaseMainSupport extends BaseService 
{
         if (standalone) {
             // the beans that the routes define (such as the beans section of 
a YAML or XML DSL file) are not
             // configured from camel.* properties, so their properties are 
checked once the routes are loaded and
-            // the registry is post-processed (which adds the delayed Spring 
XML and Blueprint XML beans)
+            // the registry is post-processed
             enforceSecurityPoliciesOnBeans(camelContext);
         }
 
diff --git 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 93b56ceb4dea..c0204f924d63 100644
--- 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -1420,7 +1420,7 @@ public class ModelParser extends BaseParser {
         return doParse(new ApplicationDefinition(), noAttributeHandler(), 
beansDefinitionElementHandler(), noValueHandler());
     }
     public Optional<ApplicationDefinition> parseApplicationDefinition() throws 
IOException, XmlPullParserException {
-        String tag = getNextTag("beans", "blueprint", "camel");
+        String tag = getNextTag("beans", "camel");
         if (tag != null) {
             return Optional.of(doParseApplicationDefinition());
         }
@@ -1428,22 +1428,6 @@ public class ModelParser extends BaseParser {
     }
     protected <T extends BeansDefinition> ElementHandler<T> 
beansDefinitionElementHandler() {
         return (def, key) -> {
-            if 
("http://www.springframework.org/schema/beans".equals(parser.getNamespace())) {
-                Element el = doParseDOMElement("beans", 
"http://www.springframework.org/schema/beans";, def.getSpringOrBlueprintBeans());
-                if (el != null) {
-                    doAddElement(el, def.getSpringOrBlueprintBeans(), 
def::setSpringOrBlueprintBeans);
-                    return true;
-                }
-                return false;
-            }
-            if 
("http://www.osgi.org/xmlns/blueprint/v1.0.0".equals(parser.getNamespace())) {
-                Element el = doParseDOMElement("blueprint", 
"http://www.osgi.org/xmlns/blueprint/v1.0.0";, def.getSpringOrBlueprintBeans());
-                if (el != null) {
-                    doAddElement(el, def.getSpringOrBlueprintBeans(), 
def::setSpringOrBlueprintBeans);
-                    return true;
-                }
-                return false;
-            }
             switch (key) {
                 case "bean": doAdd(doParseBeanFactoryDefinition(), 
def.getBeans(), def::setBeans); break;
                 case "component-scan": doAdd(doParseComponentScanDefinition(), 
def.getComponentScanning(), def::setComponentScanning); break;
@@ -1469,7 +1453,7 @@ public class ModelParser extends BaseParser {
         return doParse(new BeansDefinition(), noAttributeHandler(), 
beansDefinitionElementHandler(), noValueHandler(), true);
     }
     public Optional<BeansDefinition> parseBeansDefinition() throws 
IOException, XmlPullParserException {
-        String tag = getNextTag("beans", "blueprint", "camel");
+        String tag = getNextTag("beans", "camel");
         if (tag != null) {
             return Optional.of(doParseBeansDefinition());
         }
diff --git 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 510b0ab7d378..b768d0559bc4 100644
--- 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -2111,7 +2111,6 @@ public class ModelWriter extends BaseWriter {
     protected void doWriteBeansDefinitionElements(BeansDefinition def) throws 
IOException {
         doWriteList(null, "component-scan", def.getComponentScanning(), 
this::doWriteComponentScanDefinition);
         doWriteList(null, "bean", def.getBeans(), 
this::doWriteBeanFactoryDefinition);
-        domElements(def.getSpringOrBlueprintBeans());
         doWriteList(null, "sslContextParameters", 
def.getSslContextParameters(), this::doWriteSSLContextParametersDefinition);
         doWriteList("dataFormats", "dataFormat", def.getDataFormats(), 
this::doWriteDataFormatDefinition);
         doWriteList(null, "restConfiguration", def.getRestConfigurations(), 
this::doWriteRestConfigurationDefinition);
diff --git 
a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java 
b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
index aade3352b428..d8398ad1d4de 100644
--- 
a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
+++ 
b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.xml.in;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.StringReader;
-import java.io.StringWriter;
 import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -27,12 +26,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Stream;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Document;
-
 import org.apache.camel.model.BeanFactoryDefinition;
 import org.apache.camel.model.FromDefinition;
 import org.apache.camel.model.PropertyDefinition;
@@ -63,7 +56,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -248,7 +240,6 @@ public class ModelParserTest {
         BeansDefinition beans = parser.parseBeansDefinition().orElse(null);
         assertNotNull(beans);
         assertTrue(beans.getBeans().isEmpty());
-        assertTrue(beans.getSpringOrBlueprintBeans().isEmpty());
     }
 
     @Test
@@ -259,7 +250,6 @@ public class ModelParserTest {
         BeansDefinition beans = parser.parseBeansDefinition().orElse(null);
         assertNotNull(beans);
         assertEquals(2, beans.getBeans().size());
-        assertTrue(beans.getSpringOrBlueprintBeans().isEmpty());
 
         BeanFactoryDefinition b1 = beans.getBeans().get(0);
         BeanFactoryDefinition b2 = beans.getBeans().get(1);
@@ -289,7 +279,6 @@ public class ModelParserTest {
         BeansDefinition beans = parser.parseBeansDefinition().orElse(null);
         assertNotNull(beans);
         assertEquals(2, beans.getBeans().size());
-        assertTrue(beans.getSpringOrBlueprintBeans().isEmpty());
 
         BeanFactoryDefinition b1 = beans.getBeans().get(0);
         BeanFactoryDefinition b2 = beans.getBeans().get(1);
@@ -316,7 +305,6 @@ public class ModelParserTest {
         BeansDefinition beans = parser.parseBeansDefinition().orElse(null);
         assertNotNull(beans);
         assertEquals(2, beans.getBeans().size());
-        assertTrue(beans.getSpringOrBlueprintBeans().isEmpty());
 
         BeanFactoryDefinition b1 = beans.getBeans().get(0);
         BeanFactoryDefinition b2 = beans.getBeans().get(1);
@@ -338,27 +326,12 @@ public class ModelParserTest {
     }
 
     @Test
-    public void testSpringBeans() throws Exception {
+    public void testSpringBeansNotSupported() throws Exception {
         Path dir = getResourceFolder();
         Path path = new File(dir.toFile(), "beansWithSpringNS.xml").toPath();
         final ModelParser parser = new ModelParser(Files.newInputStream(path), 
NAMESPACE);
-        BeansDefinition beans = parser.parseBeansDefinition().orElse(null);
-        assertNotNull(beans);
-        assertTrue(beans.getBeans().isEmpty());
-        assertEquals(2, beans.getSpringOrBlueprintBeans().size());
-        Document dom = 
beans.getSpringOrBlueprintBeans().get(0).getOwnerDocument();
-        StringWriter sw = new StringWriter();
-        TransformerFactory.newInstance().newTransformer().transform(new 
DOMSource(dom), new StreamResult(sw));
-        String document = sw.toString();
-        assertTrue(document.contains("class=\"java.lang.String\""));
-
-        assertSame(beans.getSpringOrBlueprintBeans().get(0).getOwnerDocument(),
-                beans.getSpringOrBlueprintBeans().get(1).getOwnerDocument());
-        assertEquals("s1", 
beans.getSpringOrBlueprintBeans().get(0).getAttribute("id"));
-        assertEquals("s2", 
beans.getSpringOrBlueprintBeans().get(1).getAttribute("id"));
-
-        assertEquals(1, beans.getComponentScanning().size());
-        assertEquals("com.example", 
beans.getComponentScanning().get(0).getBasePackage());
+        // legacy Spring XML <bean> elements are no longer supported
+        assertThrows(XmlPullParserLocationException.class, 
parser::parseBeansDefinition);
     }
 
     @Test
diff --git a/core/camel-xml-io/src/test/resources/beansWithSpringNS.xml 
b/core/camel-xml-io/src/test/resources/beansWithSpringNS.xml
index 88690cf4f183..e743e4dfda0e 100644
--- a/core/camel-xml-io/src/test/resources/beansWithSpringNS.xml
+++ b/core/camel-xml-io/src/test/resources/beansWithSpringNS.xml
@@ -17,7 +17,7 @@
     limitations under the License.
 
 -->
-<beans xmlns="http://camel.apache.org/schema/xml-io"; 
xmlns:s="http://www.springframework.org/schema/beans";>
+<camel xmlns="http://camel.apache.org/schema/xml-io"; 
xmlns:s="http://www.springframework.org/schema/beans";>
 
        <s:bean id="s1" class="java.lang.String">
                <s:description>Real Spring Bean</s:description>
@@ -37,4 +37,4 @@
 
        <component-scan base-package="com.example" />
 
-</beans>
+</camel>
diff --git a/design/security.adoc b/design/security.adoc
index 25b77df07d4f..e9db96deb2bd 100644
--- a/design/security.adoc
+++ b/design/security.adoc
@@ -132,8 +132,8 @@ The annotations flow through the existing build pipeline:
    to security categories
 4. **Runtime detection** — at startup, `SecurityUtils.detectViolations()` 
checks all resolved
    properties against the generated map. Once the routes are loaded, 
camel-main also checks the properties of the
-   beans that the route files define (the `beans` section of a YAML or XML DSL 
file, and the Spring XML and Blueprint
-   XML beans, kept as `BeanFactoryDefinition` in the model), under the key of 
a bean configured from properties:
+   beans that the route files define (the `beans` section of a YAML or XML DSL 
file, kept as `BeanFactoryDefinition`
+   in the model), under the key of a bean configured from properties:
    `camel.beans.<name>.<property>`
 
 No new build plugins are needed. The existing `@UriParam` → JSON → code 
generation pipeline
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index eeb5819b9fa4..543b6b15d72e 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -443,3 +443,60 @@ When the `circuitBreaker` option is also set, that circuit 
breaker keeps its own
 ignore exceptions of the `config` option decide whether the fallback runs.
 
 A reference that is not in the registry now fails the route at startup, as the 
`circuitBreaker` option does.
+
+=== camel-xml-io-dsl - legacy Spring XML <beans> and OSGi <blueprint> files 
removed
+
+The XML DSL (`camel-xml-io-dsl`) no longer loads legacy Spring XML `<beans>` 
files and OSGi `<blueprint>` files, and
+no longer accepts Spring Beans XML (`<beans 
xmlns="http://www.springframework.org/schema/beans";>`) or a
+`<camelContext>` of Spring XML or Blueprint XML inside a `<camel>` file (put 
the routes, rests and data formats directly
+inside `<camel>`). This support was deprecated in Camel 4.22, and was only 
available in Camel CLI (`camel run`) and Camel Main
+with `camel-kamelet-main`.
+
+Loading such a file now fails with an error that explains how to migrate, 
instead of starting with the beans missing:
+
+----
+Legacy Spring XML <beans> and OSGi <blueprint> XML is not supported by the XML 
DSL (camel-xml-io-dsl). ...
+----
+
+To migrate:
+
+* Declare the beans with Camel's own `<bean>` elements in the `<camel>` file. 
Use `#bean:name` to refer to another
+  bean. For example, the Spring bean:
++
+[source,xml]
+----
+<beans xmlns="http://www.springframework.org/schema/beans";>
+    <bean id="greeter" class="com.acme.Greeter">
+        <constructor-arg index="0" value="Hello"/>
+        <property name="message" ref="myMessage"/>
+    </bean>
+</beans>
+----
++
+becomes:
++
+[source,xml]
+----
+<bean name="greeter" type="com.acme.Greeter">
+    <constructors>
+        <constructor index="0" value="Hello"/>
+    </constructors>
+    <properties>
+        <property key="message" value="#bean:myMessage"/>
+    </properties>
+</bean>
+----
++
+The beans that were predefined for Spring XML (`CamelContext` and 
`MainConfiguration`) are gone; a bean that needs the
+`CamelContext` can implement `CamelContextAware`.
+* To keep running Spring XML files with Spring, use `camel-spring-xml` (or 
Camel Spring Boot).
+* To convert the routes and beans of a legacy file to YAML or the XML DSL, use 
`camel transform route` of Camel CLI
+  4.22 (LTS), which still reads them. AI coding agents also do this conversion 
well, and with the Camel MCP server they
+  can validate the result against the Camel catalog.
+
+The `springOrBlueprintBeans` property of 
`org.apache.camel.model.app.BeansDefinition` is removed.
+
+The Camel CLI (`camel-kamelet-main`) no longer ships Spring Framework 
(`spring-context` and its dependencies), as it
+was only there for the Spring XML support. The Spring annotations for 
dependency injection (`@Component`,
+`@Autowired`, ...) are still downloaded on demand. Routes or beans that use 
other Spring classes must add the
+dependency, such as 
`camel.jbang.dependencies=org.springframework:spring-context:<version>`.
diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-beans.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-jbang-beans.adoc
index b68f14438609..feea9ebd3a4e 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-beans.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-beans.adoc
@@ -131,63 +131,6 @@ Properties can use nested `<property>` elements or dotted 
notation:
 </camel>
 ----
 
-== Using Spring Beans XML in Camel XML DSL
-
-You can use Spring Beans XML namespace inside Camel XML DSL. The beans are 
added to the
-xref:registry.adoc[Registry] — this does not require Spring Framework at 
runtime.
-
-Supported features:
-
-* Dependency injection
-* Constructor injection
-* Dependency cycles
-* Wiring existing Camel objects (like `CamelContext`)
-
-[source,xml]
-----
-<camel>
-
-    <beans xmlns="http://www.springframework.org/schema/beans";>
-        <bean id="messageString" class="java.lang.String">
-            <constructor-arg index="0" value="Hello"/>
-        </bean>
-
-        <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-            <property name="message">
-                <bean class="org.apache.camel.main.app.GreeterMessage">
-                    <property name="msg" ref="messageString"/>
-                </bean>
-            </property>
-        </bean>
-    </beans>
-
-    <route id="my-route">
-        <from uri="direct:start"/>
-        <bean ref="greeter"/>
-        <to uri="mock:finish"/>
-    </route>
-
-</camel>
-----
-
-=== Predefined Camel beans
-
-These beans can be referenced without declaring them:
-
-* `CamelContext` — the current `org.apache.camel.CamelContext`
-* `MainConfiguration` — the 
`org.apache.camel.main.MainConfigurationProperties` instance
-
-For example:
-
-[source,xml]
-----
-<beans xmlns="http://www.springframework.org/schema/beans";>
-    <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-        <property name="camelContext" ref="CamelContext"/>
-    </bean>
-</beans>
-----
-
 === Customizing Camel internals
 
 You can register beans that affect `CamelContext` configuration. For example, 
to replace the
@@ -197,11 +140,12 @@ default UUID generator:
 ----
 <camel>
 
-    <beans xmlns="http://www.springframework.org/schema/beans";>
-        <bean id="customUUIDGenerator" 
class="org.apache.camel.support.ShortUuidGenerator" />
-    </beans>
+    <bean name="customUUIDGenerator" 
type="org.apache.camel.support.ShortUuidGenerator"/>
 
 </camel>
 ----
 
 Camel looks up known SPI types (like `UuidGenerator`) in the Registry and uses 
them automatically.
+
+NOTE: Spring Beans XML (`<beans 
xmlns="http://www.springframework.org/schema/beans";>`) inside Camel XML DSL is 
no
+longer supported (removed in Camel 4.25). Declare the beans with `<bean>` as 
shown above.
diff --git a/docs/user-manual/modules/ROOT/pages/security-policy.adoc 
b/docs/user-manual/modules/ROOT/pages/security-policy.adoc
index 884f82849a95..b50b85a2725b 100644
--- a/docs/user-manual/modules/ROOT/pages/security-policy.adoc
+++ b/docs/user-manual/modules/ROOT/pages/security-policy.adoc
@@ -38,10 +38,10 @@ camel-hivemq) is not flagged. Any other property (such as 
`camel.ssl.trustAllCer
 option name.
 
 With camel-main and the Camel CLI, the properties of the beans that route 
files define (the `beans` section of a YAML
-or XML DSL file, and the beans of a Spring XML or Blueprint XML file) are 
checked once the routes are loaded, under the
-key of a bean configured from properties: `camel.beans.<name>.<property>`, 
such as `camel.beans.opaPolicy.failOpen`.
-The same key goes in `camel.security.allowedProperties` to allow one of them. 
Camel Spring Boot checks the
-configuration properties only, not the beans of route files.
+or XML DSL file) are checked once the routes are loaded, under the key of a 
bean configured from properties:
+`camel.beans.<name>.<property>`, such as `camel.beans.opaPolicy.failOpen`. The 
same key goes in
+`camel.security.allowedProperties` to allow one of them. Camel Spring Boot 
checks the configuration properties only,
+not the beans of route files.
 
 The security policy does not check the options set in the endpoint URIs of the 
routes, so an insecure option there,
 such as `failOpen=true` in `opa:authz/allow?failOpen=true`, is not reported.
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformTest.java
index 492b0a6142be..b08719326199 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformTest.java
@@ -30,8 +30,6 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import static org.assertj.core.api.Assertions.assertThat;
-
 class TransformTest extends CamelCommandBaseTestSupport {
 
     private Path workingDir;
@@ -67,22 +65,6 @@ class TransformTest extends CamelCommandBaseTestSupport {
         Assertions.assertEquals(expected, data);
     }
 
-    @Test
-    public void shouldTransformBlueprintToYaml() throws Exception {
-        Path outPath = workingDir.resolve("blueprint.yaml");
-
-        String[] args = new String[] { "--output=" + outPath.toString() };
-        TransformRoute command = createCommand(new String[] { 
"src/test/resources/blueprint.xml" }, args);
-        int exit = command.doCall();
-        Assertions.assertEquals(0, exit);
-
-        Assertions.assertTrue(Files.exists(outPath));
-        String data = Files.readString(outPath);
-        String expected
-                = 
IOHelper.stripLineComments(Paths.get("src/test/resources/blueprint-out.yaml"), 
"#", true);
-        assertThat(data).isEqualToIgnoringNewLines(expected);
-    }
-
     private TransformRoute createCommand(String[] files, String... args) {
         TransformRoute command = new CamelJBangMain().command(new 
TransformRoute());
 
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint-out.yaml 
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint-out.yaml
deleted file mode 100644
index e304ac8d51cc..000000000000
--- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint-out.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# 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.
-#
-
-- beans:
-    - name: userService
-      type: org.apache.camel.example.rest.UserService
-- route:
-    from:
-      uri: direct
-      parameters:
-        name: getUser
-      steps:
-        - to:
-            uri: bean
-            parameters:
-              beanName: userService
-              method: "getUser(${header.id})"
-        - filter:
-            expression:
-              simple:
-                expression: "${body} == null"
-            steps:
-              - setHeader:
-                  name: Exchange.HTTP_RESPONSE_CODE
-                  expression:
-                    constant:
-                      expression: "404"
\ No newline at end of file
diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint.xml 
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint.xml
deleted file mode 100644
index adcdee6dfe3d..000000000000
--- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/blueprint.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-           xsi:schemaLocation="
-           http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
-
-    <!-- a bean for user services -->
-    <bean id="userService" class="org.apache.camel.example.rest.UserService"/>
-
-    <camelContext id="myCamel" 
xmlns="http://camel.apache.org/schema/blueprint";>
-        <route>
-            <from uri="direct:getUser"/>
-            <to uri="bean:userService?method=getUser(${header.id})"/>
-            <filter>
-                <simple>${body} == null</simple>
-                <setHeader name="Exchange.HTTP_RESPONSE_CODE">
-                    <constant>404</constant>
-                </setHeader>
-            </filter>
-        </route>
-    </camelContext>
-
-</blueprint>
diff --git a/dsl/camel-kamelet-main/pom.xml b/dsl/camel-kamelet-main/pom.xml
index caa7db491646..24424f99dfd7 100644
--- a/dsl/camel-kamelet-main/pom.xml
+++ b/dsl/camel-kamelet-main/pom.xml
@@ -169,11 +169,14 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-tooling-maven</artifactId>
         </dependency>
-        <!-- legacy Spring beans XML support -->
+        <!-- test -->
+        <!-- Spring annotations for the annotation based dependency injection 
tests
+             (at runtime they are downloaded on demand, see 
camel-main-known-dependencies.properties) -->
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
             <version>${spring-version}</version>
+            <scope>test</scope>
             <exclusions>
                 <exclusion>
                     <groupId>io.micrometer</groupId>
@@ -181,8 +184,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
-        <!-- test -->
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-jdbc</artifactId>
diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 24e44a9b721c..0a899bc1f3ae 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -25,12 +25,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
-import java.util.TreeMap;
 import java.util.function.Consumer;
 import java.util.stream.Stream;
 
-import org.w3c.dom.Document;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.ProducerTemplate;
@@ -88,8 +85,6 @@ import org.apache.camel.main.stub.StubEipReifier;
 import org.apache.camel.main.util.ClipboardReloadStrategy;
 import org.apache.camel.main.util.ExtraClassesClassLoader;
 import org.apache.camel.main.util.ExtraFilesClassLoader;
-import org.apache.camel.main.xml.blueprint.BlueprintXmlBeansHandler;
-import org.apache.camel.main.xml.spring.SpringXmlBeansHandler;
 import org.apache.camel.model.OnExceptionDefinition;
 import org.apache.camel.reifier.OnExceptionReifier;
 import org.apache.camel.reifier.ProcessorReifier;
@@ -147,9 +142,6 @@ public class KameletMain extends MainCommandLineSupport {
     private DownloadListener downloadListener;
     private DependencyDownloaderClassLoader classLoader;
 
-    private final SpringXmlBeansHandler springXmlBeansHandler = new 
SpringXmlBeansHandler();
-    private final BlueprintXmlBeansHandler blueprintXmlBeansHandler = new 
BlueprintXmlBeansHandler();
-
     /**
      * Deprecated constructor - to tightly bound to Camel CLI. Do not use.
      */
@@ -462,8 +454,6 @@ public class KameletMain extends MainCommandLineSupport {
         if (getCamelContext() != null) {
             getCamelContext().stop();
         }
-        springXmlBeansHandler.stop();
-        blueprintXmlBeansHandler.stop();
     }
 
     @Override
@@ -540,7 +530,6 @@ public class KameletMain extends MainCommandLineSupport {
             this.stubPattern = "*";
             // turn off inlining routes
             configure().rest().withInlineRoutes(false);
-            blueprintXmlBeansHandler.setTransform(true);
             // stub EIPs
             StubEipReifier.registerStubEipReifiers(answer);
         }
@@ -1070,37 +1059,6 @@ public class KameletMain extends MainCommandLineSupport {
         return infos.stream();
     }
 
-    @Override
-    protected void preProcessCamelRegistry(CamelContext camelContext, 
MainConfigurationProperties config) {
-        final Map<String, Document> springXmls = new TreeMap<>();
-        final Map<String, Document> blueprintXmls = new TreeMap<>();
-
-        Map<String, Document> xmlDocs = 
registry.findByTypeWithName(Document.class);
-        if (xmlDocs != null) {
-            xmlDocs.forEach((id, doc) -> {
-                if (id.startsWith("camel-xml-io-dsl-spring-xml:")) {
-                    springXmls.put(id, doc);
-                } else if (id.startsWith("camel-xml-io-dsl-blueprint-xml:")) {
-                    blueprintXmls.put(id, doc);
-                }
-            });
-        }
-        if (!springXmls.isEmpty()) {
-            // camel-kamelet-main has access to Spring libraries, so we can 
grab XML documents representing
-            // actual Spring Beans and read them using Spring's BeanFactory to 
populate Camel registry
-            springXmlBeansHandler.processSpringBeans(camelContext, config, 
springXmls);
-        }
-        if (!blueprintXmls.isEmpty()) {
-            blueprintXmlBeansHandler.processBlueprintBeans(camelContext, 
config, blueprintXmls);
-        }
-    }
-
-    @Override
-    protected void postProcessCamelRegistry(CamelContext camelContext, 
MainConfigurationProperties config) {
-        springXmlBeansHandler.createAndRegisterBeans(camelContext);
-        blueprintXmlBeansHandler.createAndRegisterBeans(camelContext);
-    }
-
     private boolean isConfigured(String key) {
         if (getOverrideProperties() != null) {
             String value = getOverrideProperties().getProperty(key);
diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/blueprint/BlueprintXmlBeansHandler.java
 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/blueprint/BlueprintXmlBeansHandler.java
deleted file mode 100644
index 7451a88e5440..000000000000
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/blueprint/BlueprintXmlBeansHandler.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * 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.main.xml.blueprint;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringJoiner;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.LoggingLevel;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.ShutdownRoute;
-import org.apache.camel.ShutdownRunningTask;
-import org.apache.camel.StartupSummaryLevel;
-import org.apache.camel.TypeConverterExists;
-import org.apache.camel.converter.jaxp.XmlConverter;
-import org.apache.camel.main.MainConfigurationProperties;
-import org.apache.camel.main.util.XmlHelper;
-import org.apache.camel.model.BeanFactoryDefinition;
-import org.apache.camel.model.Model;
-import org.apache.camel.model.errorhandler.RefErrorHandlerDefinition;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.spi.ResourceLoader;
-import org.apache.camel.support.CamelContextHelper;
-import org.apache.camel.support.ObjectHelper;
-import org.apache.camel.support.PluginHelper;
-import org.apache.camel.support.PropertyBindingSupport;
-import org.apache.camel.util.KeyValueHolder;
-import org.apache.camel.util.StringHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Used for parsing and discovering legacy OSGi <blueprint> XML to make it 
runnable on camel-jbang, and for tooling to
- * migrate this to modern Camel DSL in plain Camel XML or YAML DSL.
- */
-@Deprecated(since = "4.13.0")
-public class BlueprintXmlBeansHandler {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(BlueprintXmlBeansHandler.class);
-    private static final Pattern BLUEPRINT_PATTERN = 
Pattern.compile("\\$\\{(.*?)}"); // non-greedy mode
-
-    // when preparing blueprint-based beans, we may have problems loading 
classes which are provided with Java DSL
-    // that's why some beans should be processed later
-    private final Map<String, Node> delayedBeans = new LinkedHashMap<>();
-    private final Map<String, Resource> resources = new LinkedHashMap<>();
-    private final List<BeanFactoryDefinition<?>> delayedRegistrations = new 
ArrayList<>();
-    private final Map<String, KeyValueHolder<Object, String>> beansToDestroy = 
new LinkedHashMap<>();
-    private boolean transform;
-
-    public boolean isTransform() {
-        return transform;
-    }
-
-    public void setTransform(boolean transform) {
-        this.transform = transform;
-    }
-
-    /**
-     * Parses the XML documents and discovers blueprint beans, which will be 
created manually via Camel.
-     */
-    public void processBlueprintBeans(
-            CamelContext camelContext, MainConfigurationProperties config, 
final Map<String, Document> xmls) {
-
-        LOG.warn("Loading beans from classic OSGi <blueprint> XML is 
deprecated");
-
-        xmls.forEach((id, doc) -> {
-            if (id.startsWith("camel-xml-io-dsl-blueprint-xml:")) {
-                // this is a camel bean via camel-xml-io-dsl
-                String fileName = StringHelper.afterLast(id, ":");
-                discoverBeans(camelContext, fileName, doc);
-                // configure <camelContext>
-                configureCamelContext(camelContext, fileName);
-            }
-        });
-    }
-
-    /**
-     * Invoked at later stage to create and register Blueprint beans into 
Camel {@link org.apache.camel.spi.Registry}.
-     */
-    public void createAndRegisterBeans(CamelContext camelContext) {
-        if (delayedBeans.isEmpty()) {
-            return;
-        }
-
-        LOG.info("Discovered {} OSGi <blueprint> XML beans", 
delayedBeans.size());
-        for (Map.Entry<String, Node> entry : delayedBeans.entrySet()) {
-            String id = entry.getKey();
-            Node n = entry.getValue();
-            BeanFactoryDefinition<?> def = createBeanModel(camelContext, id, 
n);
-            if (transform) {
-                // transform mode should only discover and remember bean in 
model
-                LOG.debug("Discovered bean: {}", def.getName());
-                addBeanToCamelModel(camelContext, def.getName(), def);
-            } else {
-                LOG.debug("Creating bean: {}", def.getName());
-                registerAndCreateBean(camelContext, def, true);
-            }
-        }
-
-        if (!delayedRegistrations.isEmpty()) {
-            // some of the beans were not available yet, so we have to try 
register them now
-            for (BeanFactoryDefinition<?> def : delayedRegistrations) {
-                LOG.debug("Creating bean (2nd-try): {}", def.getName());
-                registerAndCreateBean(camelContext, def, false);
-            }
-            delayedRegistrations.clear();
-        }
-
-    }
-
-    private BeanFactoryDefinition<?> createBeanModel(CamelContext 
camelContext, String name, Node node) {
-        BeanFactoryDefinition<?> def = new BeanFactoryDefinition<>();
-        def.setResource(resources.get(name));
-        def.setType(XmlHelper.getAttribute(node, "class"));
-        def.setName(name);
-
-        // factory bean/method
-        String fb = XmlHelper.getAttribute(node, "factory-ref");
-        if (fb != null) {
-            def.setFactoryBean(fb);
-        }
-        String fm = XmlHelper.getAttribute(node, "factory-method");
-        if (fm != null) {
-            def.setFactoryMethod(fm);
-        }
-        String im = XmlHelper.getAttribute(node, "init-method");
-        if (im != null) {
-            def.setInitMethod(im);
-        }
-        String dm = XmlHelper.getAttribute(node, "destroy-method");
-        if (dm != null) {
-            def.setDestroyMethod(dm);
-        }
-        // constructor arguments
-        Map<Integer, Object> constructors = new LinkedHashMap<>();
-        def.setConstructors(constructors);
-        NodeList props = node.getChildNodes();
-        int index = 0;
-        for (int i = 0; i < props.getLength(); i++) {
-            Node child = props.item(i);
-            // assume the args are in order (1, 2)
-            if ("argument".equals(child.getNodeName())) {
-                String val = XmlHelper.getAttribute(child, "value");
-                String ref = XmlHelper.getAttribute(child, "ref");
-                if (val != null) {
-                    constructors.put(index++, extractValue(camelContext, val, 
false));
-                } else if (ref != null) {
-                    constructors.put(index++, "#bean:" + 
extractValue(camelContext, ref, false));
-                }
-            }
-        }
-        if (!constructors.isEmpty()) {
-            def.setConstructors(constructors);
-        }
-
-        // property values
-        Map<String, Object> properties = new LinkedHashMap<>();
-        props = node.getChildNodes();
-        for (int i = 0; i < props.getLength(); i++) {
-            Node child = props.item(i);
-            // assume the args are in order (1, 2)
-            if ("property".equals(child.getNodeName())) {
-                String key = XmlHelper.getAttribute(child, "name");
-                String val = XmlHelper.getAttribute(child, "value");
-                String ref = XmlHelper.getAttribute(child, "ref");
-                if (key != null && val != null) {
-                    properties.put(key, extractValue(camelContext, val, 
false));
-                } else if (key != null && ref != null) {
-                    properties.put(key, extractValue(camelContext, "#bean:" + 
ref, false));
-                }
-                for (Node n : getChildNodes(child, "list")) {
-                    int j = 0;
-                    for (Node v : getChildNodes(n, "value")) {
-                        val = v.getTextContent();
-                        if (key != null && val != null) {
-                            String k = key + "[" + j + "]";
-                            properties.put(k, extractValue(camelContext, val, 
false));
-                        }
-                        j++;
-                    }
-                }
-                for (Node n : getChildNodes(child, "map")) {
-                    for (Node v : getChildNodes(n, "entry")) {
-                        String k = XmlHelper.getAttribute(v, "key");
-                        val = XmlHelper.getAttribute(v, "value");
-                        if (key != null && k != null && val != null) {
-                            k = key + "[" + k + "]";
-                            properties.put(k, extractValue(camelContext, val, 
false));
-                        }
-                    }
-                }
-            }
-        }
-        if (!properties.isEmpty()) {
-            def.setProperties(properties);
-        }
-
-        return def;
-    }
-
-    private static List<Node> getChildNodes(Node node, String name) {
-        List<Node> answer = new ArrayList<>();
-        NodeList list = node.getChildNodes();
-        for (int j = 0; j < list.getLength(); j++) {
-            Node entry = list.item(j);
-            if (name.equals(entry.getNodeName())) {
-                answer.add(entry);
-            }
-        }
-        return answer;
-    }
-
-    private void configureCamelContext(CamelContext camelContext, String 
fileName) {
-        Resource resource = 
camelContext.getCamelContextExtension().getContextPlugin(ResourceLoader.class)
-                .resolveResource("file:" + fileName);
-        if (!resource.exists()) {
-            return;
-        }
-
-        try {
-            // need to load and parse again as we need to load <camelContext> 
to configure CamelContext from XML
-            Document dom = new 
XmlConverter().toDOMDocument(resource.getInputStream(), null);
-            NodeList camels = 
dom.getElementsByTagNameNS("http://camel.apache.org/schema/blueprint";, 
"camelContext");
-            if (camels.getLength() == 1) {
-                Node n = camels.item(0);
-                if (n.hasAttributes()) {
-                    String value = XmlHelper.getAttribute(n, "id");
-                    if (value != null) {
-                        
camelContext.getCamelContextExtension().setName(CamelContextHelper.parseText(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "startupSummaryLevel");
-                    if (value != null) {
-                        camelContext
-                                .setStartupSummaryLevel(
-                                        CamelContextHelper.parse(camelContext, 
StartupSummaryLevel.class, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "trace");
-                    if (value != null) {
-                        
camelContext.setTracing(CamelContextHelper.parseBoolean(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "backlogTrace");
-                    if (value != null) {
-                        
camelContext.setBacklogTracing(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "tracePattern");
-                    if (value != null) {
-                        
camelContext.setTracingPattern(CamelContextHelper.parseText(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "traceLoggingFormat");
-                    if (value != null) {
-                        
camelContext.setTracingLoggingFormat(CamelContextHelper.parseText(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "debug");
-                    if (value != null) {
-                        
camelContext.setDebugging(CamelContextHelper.parseBoolean(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "messageHistory");
-                    if (value != null) {
-                        
camelContext.setMessageHistory(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "sourceLocationEnabled");
-                    if (value != null) {
-                        
camelContext.setSourceLocationEnabled(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "logMask");
-                    if (value != null) {
-                        
camelContext.setLogMask(CamelContextHelper.parseBoolean(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"logExhaustedMessageBody");
-                    if (value != null) {
-                        
camelContext.setLogExhaustedMessageBody(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "streamCache");
-                    if (value != null) {
-                        
camelContext.setStreamCaching(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "delayer");
-                    if (value != null) {
-                        
camelContext.setDelayer(CamelContextHelper.parseLong(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "autoStartup");
-                    if (value != null) {
-                        
camelContext.setAutoStartup(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "dumpRoutes");
-                    if (value != null) {
-                        
camelContext.setDumpRoutes(CamelContextHelper.parseText(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "useMDCLogging");
-                    if (value != null) {
-                        
camelContext.setUseMDCLogging(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "mdcLoggingKeysPattern");
-                    if (value != null) {
-                        
camelContext.setMDCLoggingKeysPattern(CamelContextHelper.parseText(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "useDataType");
-                    if (value != null) {
-                        
camelContext.setUseDataType(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "useBreadcrumb");
-                    if (value != null) {
-                        
camelContext.setUseBreadcrumb(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"allowUseOriginalMessage");
-                    if (value != null) {
-                        
camelContext.setAllowUseOriginalMessage(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"caseInsensitiveHeaders");
-                    if (value != null) {
-                        
camelContext.setCaseInsensitiveHeaders(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "autowiredEnabled");
-                    if (value != null) {
-                        
camelContext.setAutowiredEnabled(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, "threadNamePattern");
-                    if (value != null) {
-                        camelContext.getExecutorServiceManager()
-                                
.setThreadNamePattern(CamelContextHelper.parseText(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "shutdownRoute");
-                    if (value != null) {
-                        
camelContext.setShutdownRoute(CamelContextHelper.parse(camelContext, 
ShutdownRoute.class, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "shutdownRunningTask");
-                    if (value != null) {
-                        camelContext
-                                .setShutdownRunningTask(
-                                        CamelContextHelper.parse(camelContext, 
ShutdownRunningTask.class, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "shutdownRunningTask");
-                    if (value != null) {
-                        
camelContext.setLoadTypeConverters(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"typeConverterStatisticsEnabled");
-                    if (value != null) {
-                        
camelContext.setTypeConverterStatisticsEnabled(CamelContextHelper.parseBoolean(camelContext,
 value));
-                    }
-                    value = XmlHelper.getAttribute(n, "loadHealthChecks");
-                    if (value != null) {
-                        
camelContext.setLoadHealthChecks(CamelContextHelper.parseBoolean(camelContext, 
value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"inflightRepositoryBrowseEnabled");
-                    if (value != null) {
-                        camelContext.getInflightRepository()
-                                
.setInflightBrowseEnabled(CamelContextHelper.parseBoolean(camelContext, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "typeConverterExists");
-                    if (value != null) {
-                        camelContext.getTypeConverterRegistry()
-                                .setTypeConverterExists(
-                                        CamelContextHelper.parse(camelContext, 
TypeConverterExists.class, value));
-                    }
-                    value = XmlHelper.getAttribute(n, 
"typeConverterExistsLoggingLevel");
-                    if (value != null) {
-                        
camelContext.getTypeConverterRegistry().setTypeConverterExistsLoggingLevel(
-                                CamelContextHelper.parse(camelContext, 
LoggingLevel.class, value));
-                    }
-                    value = XmlHelper.getAttribute(n, "errorHandlerRef");
-                    if (value != null) {
-                        camelContext.getCamelContextExtension()
-                                .setErrorHandlerFactory(
-                                        new 
RefErrorHandlerDefinition(CamelContextHelper.parseText(camelContext, value)));
-                    }
-                }
-            }
-        } catch (Exception e) {
-            throw RuntimeCamelException.wrapRuntimeException(e);
-        }
-    }
-
-    private void discoverBeans(CamelContext camelContext, String fileName, 
Document dom) {
-        Resource resource = 
camelContext.getCamelContextExtension().getContextPlugin(ResourceLoader.class)
-                .resolveResource("file:" + fileName);
-
-        NodeList beans = dom.getElementsByTagName("bean");
-        for (int i = 0; i < beans.getLength(); i++) {
-            Node n = beans.item(i);
-            if (n.hasAttributes()) {
-                String id = XmlHelper.getAttribute(n, "id");
-                if (id != null) {
-                    delayedBeans.put(id, n);
-                    resources.put(id, resource);
-                }
-            }
-        }
-    }
-
-    protected String extractValue(CamelContext camelContext, String val, 
boolean resolve) {
-        // blueprint placeholder prefix
-        if (val != null && val.contains("${")) {
-            Matcher matcher = BLUEPRINT_PATTERN.matcher(val);
-            while (matcher.find()) {
-                String replace = "{{" + matcher.group(1) + "}}";
-                val = matcher.replaceFirst(replace);
-                // we changed so reset matcher so it can find more
-                matcher.reset(val);
-            }
-        }
-
-        if (resolve && camelContext != null) {
-            // if running camel then resolve property placeholders from beans
-            val = camelContext.resolvePropertyPlaceholders(val);
-        }
-        return val;
-    }
-
-    /**
-     * Try to instantiate bean from the definition.
-     */
-    private void registerAndCreateBean(CamelContext camelContext, 
BeanFactoryDefinition<?> def, boolean delayIfFailed) {
-        String type = def.getType();
-        String name = def.getName();
-        if (name == null || name.isBlank()) {
-            name = type;
-        }
-        if (type != null) {
-            if (!type.startsWith("#")) {
-                type = "#class:" + type;
-            }
-            try {
-                // factory bean/method
-                if (def.getFactoryBean() != null && def.getFactoryMethod() != 
null) {
-                    type = type + "#" + def.getFactoryBean() + ":" + 
def.getFactoryMethod();
-                } else if (def.getFactoryMethod() != null) {
-                    type = type + "#" + def.getFactoryMethod();
-                }
-                // property binding support has constructor arguments as part 
of the type
-                StringJoiner ctr = new StringJoiner(", ");
-                if (def.getConstructors() != null && 
!def.getConstructors().isEmpty()) {
-                    // need to sort constructor args based on index position
-                    Map<Integer, Object> sorted = new 
TreeMap<>(def.getConstructors());
-                    for (Object val : sorted.values()) {
-                        String text = val.toString();
-                        if (!StringHelper.isQuoted(text)) {
-                            text = "\"" + text + "\"";
-                        }
-                        ctr.add(text);
-                    }
-                    type = type + "(" + ctr + ")";
-                }
-
-                final Object target = 
PropertyBindingSupport.resolveBean(camelContext, type);
-
-                if (def.getProperties() != null && 
!def.getProperties().isEmpty()) {
-                    PropertyBindingSupport.setPropertiesOnTarget(camelContext, 
target, def.getProperties());
-                }
-
-                bindBean(camelContext, def, name, target);
-
-            } catch (Exception e) {
-                if (delayIfFailed) {
-                    delayedRegistrations.add(def);
-                } else {
-                    boolean ignore = 
PluginHelper.getRoutesLoader(camelContext).isIgnoreLoadingError();
-                    if (ignore) {
-                        // still add bean if we are ignore loading as we want 
to know about all beans if possible
-                        addBeanToCamelModel(camelContext, name, def);
-                    }
-                    LOG.warn("Error creating bean: {} due to: {}. This 
exception is ignored.", type, e.getMessage(), e);
-                }
-            }
-        }
-    }
-
-    protected void bindBean(CamelContext camelContext, 
BeanFactoryDefinition<?> def, String name, Object target)
-            throws Exception {
-        // destroy and unbind any existing bean
-        destroyBean(name, true);
-        camelContext.getRegistry().unbind(name);
-
-        // invoke init method and register bean
-        String initMethod = def.getInitMethod();
-        if (initMethod != null) {
-            ObjectHelper.invokeMethodSafe(initMethod, target);
-        }
-        camelContext.getRegistry().bind(name, target);
-
-        // remember to destroy bean on shutdown
-        if (def.getDestroyMethod() != null) {
-            beansToDestroy.put(name, new KeyValueHolder<>(target, 
def.getDestroyMethod()));
-        }
-
-        addBeanToCamelModel(camelContext, name, def);
-    }
-
-    protected void addBeanToCamelModel(CamelContext camelContext, String name, 
BeanFactoryDefinition<?> def) {
-        // register bean in model
-        Model model = 
camelContext.getCamelContextExtension().getContextPlugin(Model.class);
-        if (model != null) {
-            LOG.debug("Adding OSGi <blueprint> XML bean: {} to DSL model", 
name);
-            model.addCustomBean(def);
-        }
-    }
-
-    protected void destroyBean(String name, boolean remove) {
-        var holder = remove ? beansToDestroy.remove(name) : 
beansToDestroy.get(name);
-        if (holder != null) {
-            String destroyMethod = holder.getValue();
-            Object target = holder.getKey();
-            try {
-                ObjectHelper.invokeMethodSafe(destroyMethod, target);
-            } catch (Exception e) {
-                LOG.warn("Error invoking destroy method: {} on bean: {} due 
to: {}. This exception is ignored.",
-                        destroyMethod, target, e.getMessage(), e);
-            }
-        }
-    }
-
-    public void stop() {
-        // beans should trigger destroy methods on shutdown
-        for (String name : beansToDestroy.keySet()) {
-            destroyBean(name, false);
-        }
-        beansToDestroy.clear();
-    }
-
-}
diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/spring/SpringXmlBeansHandler.java
 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/spring/SpringXmlBeansHandler.java
deleted file mode 100644
index 8bacbe01469f..000000000000
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/xml/spring/SpringXmlBeansHandler.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.main.xml.spring;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.w3c.dom.Document;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.main.MainConfigurationProperties;
-import org.apache.camel.model.BeanFactoryDefinition;
-import org.apache.camel.model.Model;
-import org.apache.camel.spi.ResourceLoader;
-import org.apache.camel.support.ObjectHelper;
-import org.apache.camel.util.StringHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.CannotLoadBeanClassException;
-import org.springframework.beans.factory.SmartFactoryBean;
-import org.springframework.beans.factory.SmartInitializingSingleton;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanReference;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.config.TypedStringValue;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.GenericBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.io.AbstractResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.metrics.StartupStep;
-
-/**
- * Used for parsing and discovering legacy Spring XML <beans> to make it 
runnable on camel-jbang, and for tooling to
- * migrate this to modern Camel DSL in plain Camel XML or YAML DSL.
- */
-@Deprecated(since = "4.13.0")
-public class SpringXmlBeansHandler {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(SpringXmlBeansHandler.class);
-    private static final Pattern SPRING_PATTERN = 
Pattern.compile("\\$\\{(.*?)}"); // non-greedy mode
-
-    // when preparing spring-based beans, we may have problems loading classes 
which are provided with Java DSL
-    // that's why some beans should be processed later
-    private final List<String> delayedBeans = new LinkedList<>();
-    // register some existing beans (the list may change)
-    // would be nice to keep the documentation up to date: 
docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
-    private final Set<String> infraBeanNames = Set.of("CamelContext", 
"MainConfiguration");
-
-    /**
-     * Parses the XML documents and discovers spring beans, which will be 
created by Spring {@link BeanFactory}.
-     */
-    public void processSpringBeans(
-            CamelContext camelContext, MainConfigurationProperties config, 
final Map<String, Document> xmls) {
-
-        LOG.warn("Loading beans from classic Spring <beans> XML is deprecated 
(use camel-spring-xml)");
-
-        // we _could_ create something like 
org.apache.camel.spring.spi.ApplicationContextBeanRepository, but
-        // wrapping DefaultListableBeanFactory and use it as one of the
-        // org.apache.camel.support.DefaultRegistry.repositories, but for now 
let's use it to populate
-        // Spring registry and then copy the beans (whether the scope is)
-        final DefaultListableBeanFactory beanFactory = new 
DefaultListableBeanFactory();
-        beanFactory.setAllowCircularReferences(true); // for now
-        
beanFactory.setBeanClassLoader(camelContext.getApplicationContextClassLoader());
-        beanFactory.setBeanExpressionResolver((value, beanExpressionContext) 
-> extractValue(camelContext, value, true));
-        camelContext.getRegistry().bind("SpringBeanFactory", beanFactory);
-
-        beanFactory.registerSingleton("CamelContext", camelContext);
-        beanFactory.registerSingleton("MainConfiguration", config);
-        // ...
-
-        // instead of generating an MX parser for spring-beans.xsd and use it 
to read the docs, we can simply
-        // pass w3c Documents directly to Spring
-        final XmlBeanDefinitionReader reader = new 
XmlBeanDefinitionReader(beanFactory);
-        xmls.forEach((id, doc) -> {
-            reader.registerBeanDefinitions(doc, new AbstractResource() {
-                @Override
-                public String getFilename() {
-                    if (id.startsWith("camel-xml-io-dsl-spring-xml:")) {
-                        // this is a camel bean via camel-xml-io-dsl
-                        return StringHelper.afterLast(id, ":");
-                    }
-                    return null;
-                }
-
-                @Override
-                public String getDescription() {
-                    return id;
-                }
-
-                @Override
-                public InputStream getInputStream() throws IOException {
-                    return new ByteArrayInputStream(new byte[0]);
-                }
-            });
-        });
-
-        // for full interaction between Spring ApplicationContext and its 
BeanFactory see
-        // 
org.springframework.context.support.AbstractApplicationContext.refresh()
-        // see 
org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory()
 to check
-        // which extra/infra beans are added
-        beanFactory.freezeConfiguration();
-
-        List<String> beanNames = 
Arrays.asList(beanFactory.getBeanDefinitionNames());
-
-        // Trigger initialization of all non-lazy singleton beans...
-        LOG.info("Discovered {} Spring XML <beans>", beanNames.size());
-        instantiateAndRegisterBeans(camelContext, beanFactory, beanNames);
-    }
-
-    /**
-     * Invoked at later stage to create and register Spring beans into Camel 
{@link org.apache.camel.spi.Registry}.
-     */
-    public void createAndRegisterBeans(CamelContext camelContext) {
-        if (delayedBeans.isEmpty()) {
-            return;
-        }
-
-        DefaultListableBeanFactory beanFactory
-                = 
camelContext.getRegistry().lookupByNameAndType("SpringBeanFactory", 
DefaultListableBeanFactory.class);
-
-        // we have some beans with classes that we couldn't load before. now, 
after loading the routes
-        // we may have the needed class definitions
-        for (String beanName : delayedBeans) {
-            BeanDefinition bd = beanFactory.getMergedBeanDefinition(beanName);
-            if (bd instanceof AbstractBeanDefinition abd) {
-                if (!abd.hasBeanClass()) {
-                    Class<?> c = 
camelContext.getClassResolver().resolveClass(abd.getBeanClassName());
-                    abd.setBeanClass(c);
-                }
-            }
-        }
-
-        instantiateAndRegisterBeans(camelContext, beanFactory, delayedBeans);
-    }
-
-    private void instantiateAndRegisterBeans(
-            CamelContext camelContext, DefaultListableBeanFactory beanFactory, 
List<String> beanNames) {
-        List<String> instantiatedBeanNames = new LinkedList<>();
-
-        for (String beanName : beanNames) {
-            BeanDefinition bd = beanFactory.getMergedBeanDefinition(beanName);
-            if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) {
-                try {
-                    if (beanFactory.isFactoryBean(beanName)) {
-                        Object bean = 
beanFactory.getBean(BeanFactory.FACTORY_BEAN_PREFIX + beanName);
-                        if (bean instanceof SmartFactoryBean<?> 
smartFactoryBean && smartFactoryBean.isEagerInit()) {
-                            beanFactory.getBean(beanName);
-                            instantiatedBeanNames.add(beanName);
-                        }
-                    } else {
-                        beanFactory.getBean(beanName);
-                        instantiatedBeanNames.add(beanName);
-                    }
-                } catch (CannotLoadBeanClassException ignored) {
-                    // we'll try to resolve later
-                    delayedBeans.add(beanName);
-                }
-            }
-        }
-
-        // Trigger post-initialization callback for all applicable beans...
-        for (String beanName : instantiatedBeanNames) {
-            Object singletonInstance = beanFactory.getSingleton(beanName);
-            if (singletonInstance instanceof SmartInitializingSingleton 
smartSingleton) {
-                StartupStep smartInitialize = 
beanFactory.getApplicationStartup()
-                        .start("spring.beans.smart-initialize")
-                        .tag("beanName", beanName);
-                smartSingleton.afterSingletonsInstantiated();
-                smartInitialize.end();
-            }
-        }
-
-        for (String name : instantiatedBeanNames) {
-            if (infraBeanNames.contains(name)) {
-                continue;
-            }
-            BeanDefinition def = beanFactory.getBeanDefinition(name);
-            if (def.isSingleton()) {
-                // just grab the singleton and put into registry
-                camelContext.getRegistry().bind(name, 
beanFactory.getBean(name));
-            } else {
-                // rely on the bean factory to implement prototype scope
-                camelContext.getRegistry().bind(name, (Supplier<Object>) () -> 
beanFactory.getBean(name));
-            }
-
-            addBeanToCamelModel(camelContext, name, def);
-        }
-    }
-
-    private void addBeanToCamelModel(CamelContext camelContext, String name, 
BeanDefinition def) {
-        // register bean into model (as a BeanRegistry that allows Camel DSL 
to know about these beans)
-        Model model = 
camelContext.getCamelContextExtension().getContextPlugin(Model.class);
-        if (model != null) {
-            BeanFactoryDefinition<?> bean = new BeanFactoryDefinition<>();
-            if (def instanceof GenericBeanDefinition gbd) {
-                // set camel resource to refer to the source file
-                Resource res = gbd.getResource();
-                if (res != null) {
-                    String fn = res.getFilename();
-                    if (fn != null) {
-                        
bean.setResource(camelContext.getCamelContextExtension().getContextPlugin(ResourceLoader.class)
-                                .resolveResource("file:" + fn));
-                    }
-                }
-            }
-            bean.setType(def.getBeanClassName());
-            bean.setName(name);
-            LOG.debug("Adding Spring <beans> XML bean: {} to DSL model", name);
-            model.addCustomBean(bean);
-
-            // factory bean/method
-            if (def.getFactoryBeanName() != null) {
-                bean.setFactoryBean(def.getFactoryBeanName());
-            }
-            if (def.getFactoryMethodName() != null) {
-                bean.setFactoryMethod(def.getFactoryMethodName());
-            }
-            if (def.getInitMethodName() != null) {
-                bean.setInitMethod(def.getInitMethodName());
-            }
-            if (def.getDestroyMethodName() != null) {
-                bean.setDestroyMethod(def.getDestroyMethodName());
-            }
-            // constructor arguments
-            if (def.hasConstructorArgumentValues()) {
-                Map<Integer, Object> constructors = new LinkedHashMap<>();
-                bean.setConstructors(constructors);
-
-                ConstructorArgumentValues ctrs = 
def.getConstructorArgumentValues();
-                for (int i = 0; i < ctrs.getArgumentCount(); i++) {
-                    ConstructorArgumentValues.ValueHolder vh = 
ctrs.getArgumentValue(i, Object.class);
-                    if (vh != null) {
-                        Object val = vh.getValue();
-                        if (val instanceof TypedStringValue tsv) {
-                            constructors.put(i, extractValue(camelContext, 
tsv.getValue(), false));
-                        } else if (val instanceof BeanReference br) {
-                            constructors.put(i, "#bean:" + 
extractValue(camelContext, br.getBeanName(), false));
-                        }
-                    }
-                }
-            }
-
-            // property values
-            if (def.hasPropertyValues()) {
-                Map<String, Object> properties = new LinkedHashMap<>();
-                bean.setProperties(properties);
-
-                MutablePropertyValues values = def.getPropertyValues();
-                for (PropertyValue v : values) {
-                    String key = v.getName();
-                    PropertyValue src = v.getOriginalPropertyValue();
-                    Object val = src.getValue();
-                    if (val instanceof TypedStringValue tsv) {
-                        properties.put(key, extractValue(camelContext, 
tsv.getValue(), false));
-                    } else if (val instanceof BeanReference br) {
-                        properties.put(key, "#bean:" + 
extractValue(camelContext, br.getBeanName(), false));
-                    } else if (val instanceof List) {
-                        int i = 0;
-                        Iterator<?> it = ObjectHelper.createIterator(val);
-                        while (it.hasNext()) {
-                            String k = key + "[" + i + "]";
-                            val = it.next();
-                            if (val instanceof TypedStringValue tsv) {
-                                properties.put(k, extractValue(camelContext, 
tsv.getValue(), false));
-                            } else if (val instanceof BeanReference br) {
-                                properties.put(k, "#bean:" + 
extractValue(camelContext, br.getBeanName(), false));
-                            }
-                            i++;
-                        }
-                    } else if (val instanceof Map) {
-                        Map<TypedStringValue, Object> map = (Map) val;
-                        for (Map.Entry<TypedStringValue, Object> entry : 
map.entrySet()) {
-                            String k = key + "[" + entry.getKey().getValue() + 
"]";
-                            val = entry.getValue();
-                            if (val instanceof TypedStringValue tsv) {
-                                properties.put(k, extractValue(camelContext, 
tsv.getValue(), false));
-                            } else if (val instanceof BeanReference br) {
-                                properties.put(k, "#bean:" + 
extractValue(camelContext, br.getBeanName(), false));
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    protected String extractValue(CamelContext camelContext, String val, 
boolean resolve) {
-        // spring placeholder prefix
-        if (val != null && val.contains("${")) {
-            Matcher matcher = SPRING_PATTERN.matcher(val);
-            while (matcher.find()) {
-                String replace = "{{" + matcher.group(1) + "}}";
-                val = matcher.replaceFirst(replace);
-                // we changed so reset matcher so it can find more
-                matcher.reset(val);
-            }
-        }
-
-        if (resolve && camelContext != null) {
-            // if running camel then resolve property placeholders from beans
-            val = camelContext.resolvePropertyPlaceholders(val);
-        }
-        return val;
-    }
-
-    public void stop() {
-        // noop
-    }
-
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainSecurityPolicyBeansTest.java
 
b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainSecurityPolicyBeansTest.java
deleted file mode 100644
index eda7cffc13bb..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainSecurityPolicyBeansTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.main;
-
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.main.app.MyTlsClient;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * The security policy checks the properties of the beans of Spring XML and 
Blueprint XML files, including the beans
- * that are created after the routes are loaded (all the Blueprint XML beans, 
and the delayed Spring XML beans).
- */
-class KameletMainSecurityPolicyBeansTest {
-
-    private static final String BLUEPRINT = 
"classpath:org/apache/camel/main/xml/blueprint-security-policy.xml";
-    private static final String SPRING = 
"classpath:org/apache/camel/main/xml/spring-security-policy.xml";
-
-    @Test
-    void blueprintBeanFailsStartupWithProdProfile() {
-        assertInsecureBeanFailsStartup(BLUEPRINT);
-    }
-
-    @Test
-    void springXmlBeanFailsStartupWithProdProfile() {
-        assertInsecureBeanFailsStartup(SPRING);
-    }
-
-    @Test
-    void allowedBlueprintBeanStartsWithProdProfile() {
-        KameletMain main = new KameletMain();
-        try {
-            main.addInitialProperty("camel.main.profile", "prod");
-            main.addInitialProperty("camel.security.allowedProperties", 
"camel.beans.myClient.trustAllCertificates");
-            main.configure().withRoutesIncludePattern(BLUEPRINT);
-            main.configure().withAutoConfigurationEnabled(true);
-            main.start();
-
-            MyTlsClient client = 
main.getCamelContext().getRegistry().lookupByNameAndType("myClient", 
MyTlsClient.class);
-            assertNotNull(client);
-            assertTrue(client.isTrustAllCertificates());
-        } finally {
-            main.stop();
-        }
-    }
-
-    private static void assertInsecureBeanFailsStartup(String routes) {
-        KameletMain main = new KameletMain();
-        try {
-            main.addInitialProperty("camel.main.profile", "prod");
-            main.configure().withRoutesIncludePattern(routes);
-            main.configure().withAutoConfigurationEnabled(true);
-
-            RuntimeCamelException ex = 
assertThrows(RuntimeCamelException.class, main::start);
-            assertTrue(ex.getMessage().contains("[insecure:ssl]"), 
ex.getMessage());
-            
assertTrue(ex.getMessage().contains("[camel.beans.myClient.trustAllCertificates]"),
 ex.getMessage());
-        } finally {
-            main.stop();
-        }
-    }
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainTest.java
 
b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainTest.java
deleted file mode 100644
index 03ccd93deda1..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/KameletMainTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.main;
-
-import java.util.function.BiConsumer;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.main.app.Bean1;
-import org.apache.camel.main.app.Bean2;
-import org.apache.camel.support.ShortUuidGenerator;
-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;
-import static org.junit.jupiter.api.Assertions.fail;
-
-public class KameletMainTest {
-
-    @Test
-    public void testRouteWithSpringProcessor() throws Exception {
-        doTestMain("classpath:org/apache/camel/main/xml/spring-camel1.xml", 
(main, camelContext) -> {
-            try {
-                MockEndpoint endpoint = 
camelContext.getEndpoint("mock:finish", MockEndpoint.class);
-                endpoint.expectedBodiesReceived("Hello World (2147483647)");
-
-                main.getCamelTemplate().sendBody("direct:start", "I'm World");
-
-                endpoint.assertIsSatisfied();
-
-                assertTrue(camelContext.getUuidGenerator() instanceof 
ShortUuidGenerator);
-
-                Bean1 bean1 = main.lookupByType(Bean1.class).get("bean1");
-                Bean2 bean2 = bean1.getBean();
-                assertSame(bean1, bean2.getBean());
-            } catch (Exception e) {
-                fail(e.getMessage());
-            }
-        });
-    }
-
-    @Test
-    public void testRouteWithSpringBeansAndCamelDependencies() throws 
Exception {
-        doTestMain("classpath:org/apache/camel/main/xml/spring-camel2.xml", 
(main, camelContext) -> {
-            try {
-                MockEndpoint endpoint = 
camelContext.getEndpoint("mock:finish", MockEndpoint.class);
-                endpoint.expectedBodiesReceived("Hello World (" + 
System.identityHashCode(camelContext) + ")");
-
-                main.getCamelTemplate().sendBody("direct:start", "I'm World");
-
-                endpoint.assertIsSatisfied();
-            } catch (Exception e) {
-                fail(e.getMessage());
-            }
-        });
-    }
-
-    protected void doTestMain(String includes, BiConsumer<KameletMain, 
CamelContext> consumer) throws Exception {
-        KameletMain main = new KameletMain();
-
-        main.configure().withRoutesIncludePattern(includes);
-        main.configure().withAutoConfigurationEnabled(true);
-        main.start();
-
-        CamelContext camelContext = main.getCamelContext();
-        assertNotNull(camelContext);
-
-        consumer.accept(main, camelContext);
-
-        main.stop();
-    }
-
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/Greeter.java 
b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/Greeter.java
deleted file mode 100644
index 52d29755c1c2..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/Greeter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.main.app;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.util.StringHelper;
-
-public class Greeter implements Processor {
-
-    private Bean1 bean;
-
-    private GreeterMessage message;
-
-    private Integer number;
-
-    private CamelContext camelContext;
-
-    public void setMessage(GreeterMessage message) {
-        this.message = message;
-    }
-
-    public void setNumber(Integer number) {
-        this.number = number;
-    }
-
-    public void setBean(Bean1 bean) {
-        this.bean = bean;
-    }
-
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    @Override
-    public void process(Exchange exchange) throws Exception {
-        String msg = exchange.getIn().getBody(String.class);
-        if (camelContext != null) {
-            exchange.getIn().setBody(message.getMsg() + " " + 
StringHelper.after(msg, "I'm ")
-                                     + " (" + 
System.identityHashCode(camelContext) + ")");
-        } else {
-            exchange.getIn().setBody(message.getMsg() + " " + 
StringHelper.after(msg, "I'm ")
-                                     + " (" + number + ")");
-        }
-    }
-
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/GreeterMessage.java
 
b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/GreeterMessage.java
deleted file mode 100644
index 11d4e7599673..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/GreeterMessage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.main.app;
-
-public class GreeterMessage {
-
-    private String msg;
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/MyTlsClient.java
 
b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/MyTlsClient.java
deleted file mode 100644
index 4fd55df462ed..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/app/MyTlsClient.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.main.app;
-
-public class MyTlsClient {
-
-    private boolean trustAllCertificates;
-
-    public boolean isTrustAllCertificates() {
-        return trustAllCertificates;
-    }
-
-    public void setTrustAllCertificates(boolean trustAllCertificates) {
-        this.trustAllCertificates = trustAllCertificates;
-    }
-}
diff --git 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/blueprint-security-policy.xml
 
b/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/blueprint-security-policy.xml
deleted file mode 100644
index 59105864cf99..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/blueprint-security-policy.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
-
-    <bean id="myClient" class="org.apache.camel.main.app.MyTlsClient">
-        <property name="trustAllCertificates" value="true"/>
-    </bean>
-
-    <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
-        <route id="security-policy-blueprint">
-            <from uri="direct:start"/>
-            <to uri="mock:result"/>
-        </route>
-    </camelContext>
-
-</blueprint>
diff --git 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel1.xml
 
b/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel1.xml
deleted file mode 100644
index 887aca50431a..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel1.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<camel>
-
-    <beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:util="http://www.springframework.org/schema/util";>
-
-        <util:constant id="max" static-field="java.lang.Integer.MAX_VALUE" />
-
-        <bean id="bean1" class="org.apache.camel.main.app.Bean1">
-            <property name="bean" ref="bean2"/>
-        </bean>
-        <bean id="bean2" class="org.apache.camel.main.app.Bean2">
-            <property name="bean" ref="bean1"/>
-        </bean>
-
-        <bean id="messageString" class="java.lang.String">
-            <constructor-arg index="0" value="Hello"/>
-        </bean>
-
-        <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-            <description>Real Spring Bean</description>
-            <property name="bean" ref="bean1"/>
-            <property name="number" ref="max"/>
-            <property name="message">
-                <bean class="org.apache.camel.main.app.GreeterMessage">
-                    <property name="msg" ref="messageString"/>
-                </bean>
-            </property>
-        </bean>
-
-        <bean class="org.apache.camel.support.ShortUuidGenerator"/>
-    </beans>
-
-    <route id="r1">
-        <from uri="direct:start"/>
-        <bean ref="greeter"/>
-        <to uri="mock:finish"/>
-    </route>
-
-</camel>
diff --git 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel2.xml
 
b/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel2.xml
deleted file mode 100644
index e39caba291c2..000000000000
--- 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-camel2.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<camel>
-
-    <beans xmlns="http://www.springframework.org/schema/beans";>
-
-        <bean id="messageString" class="java.lang.String">
-            <constructor-arg index="0" value="Hello"/>
-        </bean>
-
-        <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-            <property name="camelContext" ref="CamelContext"/>
-            <property name="message">
-                <bean class="org.apache.camel.main.app.GreeterMessage">
-                    <property name="msg" ref="messageString"/>
-                </bean>
-            </property>
-        </bean>
-    </beans>
-
-    <route id="r2">
-        <from uri="direct:start"/>
-        <bean ref="greeter"/>
-        <to uri="mock:finish"/>
-    </route>
-
-</camel>
diff --git a/dsl/camel-xml-io-dsl/src/main/docs/java-xml-io-dsl.adoc 
b/dsl/camel-xml-io-dsl/src/main/docs/java-xml-io-dsl.adoc
index b802837e6897..5eea60906d0b 100644
--- a/dsl/camel-xml-io-dsl/src/main/docs/java-xml-io-dsl.adoc
+++ b/dsl/camel-xml-io-dsl/src/main/docs/java-xml-io-dsl.adoc
@@ -72,48 +72,15 @@ It is now possible with `xml-io-dsl` to declare some beans 
to be bound to xref:m
 </camel>
 ----
 
-=== Loading Spring XML files with embedded beans
+=== Legacy Spring XML and OSGi Blueprint files
 
-**Deprecated**
+Legacy Spring XML `<beans>` files and OSGi `<blueprint>` files are not 
supported (removed in Camel 4.25), and neither
+are Spring Beans XML elements (`<beans 
xmlns="http://www.springframework.org/schema/beans";>`) inside Camel XML DSL
+files. Loading such a file fails with an error that explains how to migrate.
 
-While keeping all the benefits of fast XML parser used by `xml-io-dsl`, Camel 
can also process XML elements declared in other XML namespaces and process them 
separately. With this mechanism it is possible to include XML elements using 
Spring's `http://www.springframework.org/schema/beans` namespace.
-
-This brings the flexibility of Spring Beans into 
xref:components:others:main.adoc[Camel Main] without actually running any 
Spring Application Context (or Spring Boot). When elements from Spring 
namespace are found, they are used to populate and configure an instance of 
`org.springframework.beans.factory.support.DefaultListableBeanFactory` and 
leverage Spring dependency injection to wire the beans together. These beans 
are then exposed through normal xref:manual::registry.adoc[Camel Regis [...]
-
-Here's an example `camel.xml` file, which defines both the routes and beans 
used (referred to) by the route definition:
-
-.camel.xml
-[source,xml]
-----
-<camel>
-
-    <beans xmlns="http://www.springframework.org/schema/beans";>
-        <bean id="messageString" class="java.lang.String">
-            <constructor-arg index="0" value="Hello"/>
-        </bean>
-
-        <bean id="greeter" class="org.apache.camel.main.app.Greeter">
-            <description>Spring Bean</description>
-            <property name="message">
-                <bean class="org.apache.camel.main.app.GreeterMessage">
-                    <property name="msg" ref="messageString"/>
-                </bean>
-            </property>
-        </bean>
-    </beans>
-
-    <route id="my-route">
-        <from uri="direct:start"/>
-        <bean ref="greeter"/>
-        <to uri="mock:finish"/>
-    </route>
-
-</camel>
-----
-
-A `my-route` route is referring to `greeter` bean which is defined using 
Spring `<bean>` element.
-
-More examples can be found in 
xref:manual:ROOT:camel-jbang-beans.adoc#_using_spring_beans_xml_in_camel_xml_dsl[Camel
 CLI] page.
+Declare the beans with Camel's own `<bean>` elements as shown above, or use 
xref:components:others:spring-xml.adoc[Spring XML]
+(`camel-spring-xml`) to run Spring XML files with Spring. See the
+xref:manual:ROOT:camel-4x-upgrade-guide-4_25.adoc[Camel 4.25 upgrade guide] 
for how to migrate.
 
 === Using bean with constructors
 
diff --git 
a/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlModelParser.java
 
b/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlModelParser.java
index c01ef8438ab3..efe8c203d3b8 100644
--- 
a/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlModelParser.java
+++ 
b/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlModelParser.java
@@ -18,71 +18,77 @@ package org.apache.camel.dsl.xml.io;
 
 import java.io.IOException;
 
+import org.apache.camel.model.app.BeansDefinition;
 import org.apache.camel.spi.Resource;
 import org.apache.camel.xml.in.ModelParser;
 import org.apache.camel.xml.io.XmlPullParserException;
 
 /**
- * XML {@link ModelParser} that supports loading:
- * <ul>
- * <li>Standard Camel XML DSL (xml-io)</li>
- * <li>Classic Spring XML <beans> with embedded <camelContext> (limited 
parsing, to discover <routes> inside
- * <camelContext>)</li>
- * <li>Legacy OSGi <blueprint> with embedded <camelContext> (limited parsing, 
to discover <routes> inside
- * <camelContext>)</li>
- * </ul>
+ * XML {@link ModelParser} that supports loading standard Camel XML DSL 
(xml-io).
+ * <p>
+ * Legacy Spring XML {@code <beans>} and OSGi {@code <blueprint>} files are 
not supported, and fail with a message that
+ * explains how to migrate.
  */
 public class XmlModelParser extends ModelParser {
 
+    static final String SPRING_BEANS_NS = 
"http://www.springframework.org/schema/beans";;
+    static final String BLUEPRINT_BEANS_NS = 
"http://www.osgi.org/xmlns/blueprint/v1.0.0";;
+
+    static final String LEGACY_XML_MESSAGE
+            = "Legacy Spring XML <beans> and OSGi <blueprint> XML is not 
supported by the XML DSL (camel-xml-io-dsl)."
+              + " Migrate to the Camel XML DSL (use <bean> elements inside 
<camel>), or use camel-spring-xml to run"
+              + " Spring XML files with Spring.";
+
     private static final String SPRING_NS = 
"http://camel.apache.org/schema/spring";;
     private static final String BLUEPRINT_NS = 
"http://camel.apache.org/schema/blueprint";;
 
     public XmlModelParser(Resource input, String namespace) throws 
IOException, XmlPullParserException {
         super(input, namespace);
+        // <routes> and other elements of the classic Camel XML namespaces
         addSecondaryNamespace(SPRING_NS);
         addSecondaryNamespace(BLUEPRINT_NS);
     }
 
-    @Override
-    protected boolean handleUnexpectedElement(String namespace, String name) 
throws XmlPullParserException {
-        if (isWithinCamelContext(namespace, name) || 
isAriesBlueprint(namespace)) {
-            return true;
-        }
-        // support loading embedded <dataFormats> in <camel> XML files
-        if ("dataFormats".equals(name) && isCamelRoot("dataFormats")) {
-            return true;
-        }
-        return super.handleUnexpectedElement(namespace, name);
+    /**
+     * Whether the namespace is the namespace of legacy Spring XML {@code 
<beans>} or OSGi {@code <blueprint>} files.
+     */
+    static boolean isLegacyBeansNamespace(String namespace) {
+        return SPRING_BEANS_NS.equals(namespace) || 
BLUEPRINT_BEANS_NS.equals(namespace);
     }
 
     @Override
-    protected boolean ignoreUnexpectedElement(String namespace, String name) 
throws XmlPullParserException {
-        if (isWithinCamelContext(namespace, name) || 
isAriesBlueprint(namespace)) {
-            return true;
-        }
-        return super.ignoreUnexpectedElement(namespace, name);
+    protected <T extends BeansDefinition> ElementHandler<T> 
beansDefinitionElementHandler() {
+        ElementHandler<T> handler = super.beansDefinitionElementHandler();
+        return (def, key) -> {
+            // the elements of <camel> are matched by name in any namespace, 
so reject the legacy elements first
+            // (such as a Spring <bean>) instead of reading them as Camel 
elements
+            checkNotLegacyElement(parser.getNamespace(), key);
+            return handler.accept(def, key);
+        };
     }
 
-    private boolean isAriesBlueprint(String namespace) {
-        if (namespace != null && 
namespace.startsWith("http://aries.apache.org/blueprint/";)) {
+    @Override
+    protected boolean handleUnexpectedElement(String namespace, String name) 
throws XmlPullParserException {
+        checkNotLegacyElement(namespace, name);
+        // support loading embedded <dataFormats> in <camel> XML files
+        if ("dataFormats".equals(name) && isCamelRoot("dataFormats")) {
             return true;
         }
-        return false;
+        return super.handleUnexpectedElement(namespace, name);
     }
 
-    private boolean isWithinCamelContext(String namespace, String name) {
-        // accept embedded <camelContext> inside Spring XML <beans> files or 
OSGi <blueprint> files,
-        // so we can discover embedded <routes> inside this <camelContext>.
-        if ("camelContext".equals(name) && (SPRING_NS.equals(namespace) || 
BLUEPRINT_NS.equals(namespace))) {
-            return true;
+    private void checkNotLegacyElement(String namespace, String name) throws 
XmlPullParserException {
+        if (isLegacyBeansNamespace(namespace)) {
+            throw new XmlPullParserException(
+                    "Unsupported element <" + name + "> in namespace " + 
namespace + ". " + LEGACY_XML_MESSAGE, parser,
+                    null);
         }
-        String[] stack = parser.getNames();
-        for (String s : stack) {
-            if ("camelContext".equals(s) && (SPRING_NS.equals(namespace) || 
BLUEPRINT_NS.equals(namespace))) {
-                return true;
-            }
+        if ("camelContext".equals(name)) {
+            throw new XmlPullParserException(
+                    "Unsupported element <camelContext> of legacy Spring XML 
or OSGi Blueprint XML."
+                                             + " Put the routes, rests, data 
formats and other elements directly inside <camel>.",
+                    parser, null);
         }
-        return false;
     }
 
     private boolean isCamelRoot(String name) {
diff --git 
a/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlRoutesBuilderLoader.java
 
b/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlRoutesBuilderLoader.java
index 163e88b4501c..e848c4f7a669 100644
--- 
a/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlRoutesBuilderLoader.java
+++ 
b/dsl/camel-xml-io-dsl/src/main/java/org/apache/camel/dsl/xml/io/XmlRoutesBuilderLoader.java
@@ -23,12 +23,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 
-import org.w3c.dom.Document;
-
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.builder.RouteBuilder;
@@ -77,9 +74,6 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
     private final Map<String, BeansDefinition> camelAppCache = new 
ConcurrentHashMap<>();
     private final List<BeanFactoryDefinition<?>> delayedRegistrations = new 
ArrayList<>();
 
-    private final AtomicInteger counter = new AtomicInteger(0);
-    private volatile boolean springBlueprintWarned;
-
     public XmlRoutesBuilderLoader() {
         super(EXTENSION);
     }
@@ -97,8 +91,9 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
         }
         XmlStreamInfo xmlInfo = xmlInfo(resource);
         if (xmlInfo.isValid()) {
+            checkNotLegacyBeansXml(resource, xmlInfo);
             String root = xmlInfo.getRootElementName();
-            if ("beans".equals(root) || "blueprint".equals(root) || 
"camel".equals(root)) {
+            if ("beans".equals(root) || "camel".equals(root)) {
                 new XmlModelParser(resource, xmlInfo.getRootElementNamespace())
                         .parseBeansDefinition()
                         .ifPresent(bd -> {
@@ -119,6 +114,7 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
             LOG.warn("Invalid XML document: {}", 
xmlInfo.getProblem().getMessage());
             return null;
         }
+        checkNotLegacyBeansXml(input, xmlInfo);
 
         return new RouteConfigurationBuilder() {
             @Override
@@ -126,7 +122,7 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
                 String resourceLocation = input.getLocation();
                 try {
                     switch (xmlInfo.getRootElementName()) {
-                        case "beans", "blueprint", "camel" -> {
+                        case "beans", "camel" -> {
                             BeansDefinition def = 
camelAppCache.get(resourceLocation);
                             if (def != null) {
                                 configureCamel(def);
@@ -169,8 +165,8 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
             @Override
             public void configuration() throws Exception {
                 switch (xmlInfo.getRootElementName()) {
-                    // load any route configuration before that may be nested 
under camel/spring/blueprint root tag
-                    case "beans", "blueprint", "camel", "routeConfigurations", 
"routeConfiguration": {
+                    // load any route configuration before that may be nested 
under camel/beans root tag
+                    case "beans", "camel", "routeConfigurations", 
"routeConfiguration": {
                         BeansDefinition bp = 
camelAppCache.get(input.getLocation());
                         if (bp != null) {
                             bp.getRouteConfigurations().forEach(rc -> {
@@ -206,7 +202,7 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
                     delayedRegistrations.clear();
                 }
 
-                // we have access to beans and spring beans, but these are 
already processed
+                // we have access to beans, but these are already processed
                 // in preParseRoute() and possibly registered in
                 // 
org.apache.camel.main.BaseMainSupport.postProcessCamelRegistry() (if given Main 
implementation
                 // decides to do so)
@@ -391,28 +387,16 @@ public class XmlRoutesBuilderLoader extends 
RouteBuilderLoaderSupport {
             def.setResource(resource);
             registerBeanDefinition(def, true);
         }
+    }
 
-        // <s:bean>, <s:beans> and <s:alias> elements - all the elements in 
single BeansDefinition have
-        // one parent org.w3c.dom.Document - and this is what we collect from 
each resource
-        if (!app.getSpringOrBlueprintBeans().isEmpty()) { // NOSONAR
-            if (!springBlueprintWarned) {
-                springBlueprintWarned = true;
-                LOG.warn(
-                        "Detected legacy Spring <beans> or OSGi <blueprint> 
XML. This feature is deprecated and will be removed in a future release."
-                         + " Migrate to standard Camel XML DSL 
(camel-xml-io).");
-            }
-            Document doc = 
app.getSpringOrBlueprintBeans().get(0).getOwnerDocument();
-            String ns = doc.getDocumentElement().getNamespaceURI();
-            String id = null;
-            if ("http://www.springframework.org/schema/beans".equals(ns)) {
-                id = String.format("camel-xml-io-dsl-spring-xml:%05d:%s", 
counter.incrementAndGet(), resource.getLocation());
-            } else if 
("http://www.osgi.org/xmlns/blueprint/v1.0.0".equals(ns)) {
-                id = String.format("camel-xml-io-dsl-blueprint-xml:%05d:%s", 
counter.incrementAndGet(),
-                        resource.getLocation());
-            }
-            if (id != null) {
-                getCamelContext().getRegistry().bind(id, doc);
-            }
+    /**
+     * Legacy Spring XML {@code <beans>} and OSGi {@code <blueprint>} files 
are no longer supported (removed in Camel
+     * 4.25), so fail with a message that tells how to migrate, instead of 
starting with beans missing.
+     */
+    private static void checkNotLegacyBeansXml(Resource resource, 
XmlStreamInfo xmlInfo) {
+        if 
(XmlModelParser.isLegacyBeansNamespace(xmlInfo.getRootElementNamespace())) {
+            throw new IllegalArgumentException(
+                    "Cannot load " + resource.getLocation() + ". " + 
XmlModelParser.LEGACY_XML_MESSAGE);
         }
     }
 
diff --git 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlBlueprintLoadTest.java
 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlBlueprintLoadTest.java
deleted file mode 100644
index af9623fbd657..000000000000
--- 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlBlueprintLoadTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.dsl.xml.io;
-
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.support.PluginHelper;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-public class XmlBlueprintLoadTest {
-
-    @Test
-    public void testLoadRoutesBuilderFromXml() throws Exception {
-        try (DefaultCamelContext context = new DefaultCamelContext()) {
-            // load OSGi blueprint XML <blueprint> with embedded <camelContext>
-            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
-                    "/org/apache/camel/dsl/xml/io/blueprintRoutes.xml");
-
-            Assertions.assertDoesNotThrow(() -> {
-                // should be able to parse the file and not fail (camel-jbang 
supports creating spring beans)
-                PluginHelper.getRoutesLoader(context).loadRoutes(resource);
-            });
-
-            Assertions.assertEquals(1, context.getRouteDefinitions().size());
-        }
-    }
-
-    @Test
-    public void testLoadRestsBuilderFromXml() throws Exception {
-        try (DefaultCamelContext context = new DefaultCamelContext()) {
-            // load OSGi blueprint XML <blueprint> with embedded <camelContext>
-            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
-                    "/org/apache/camel/dsl/xml/io/blueprintRests.xml");
-
-            Assertions.assertDoesNotThrow(() -> {
-                // should be able to parse the file and not fail (camel-jbang 
supports creating spring beans)
-                PluginHelper.getRoutesLoader(context).loadRoutes(resource);
-            });
-
-            Assertions.assertEquals(2, context.getRestDefinitions().size());
-        }
-    }
-
-}
diff --git 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLegacyBeansLoadTest.java
 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLegacyBeansLoadTest.java
new file mode 100644
index 000000000000..4d3ca017e8a0
--- /dev/null
+++ 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLegacyBeansLoadTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.dsl.xml.io;
+
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.support.PluginHelper;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Legacy Spring XML {@code <beans>} and OSGi {@code <blueprint>} files are 
not supported, and fail with a message that
+ * explains how to migrate (instead of starting with beans missing).
+ */
+public class XmlLegacyBeansLoadTest {
+
+    @ParameterizedTest
+    @ValueSource(strings = { "legacy-spring-beans.xml", 
"legacy-blueprint.xml", "legacy-spring-beans-in-camel.xml" })
+    public void testLegacyBeansXmlFails(String file) throws Exception {
+        try (DefaultCamelContext context = new DefaultCamelContext()) {
+            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
+                    "/org/apache/camel/dsl/xml/io/" + file);
+
+            Exception e = assertThrows(Exception.class, () -> 
PluginHelper.getRoutesLoader(context).loadRoutes(resource));
+            String messages = messages(e);
+            assertTrue(messages.contains("Legacy Spring XML <beans> and OSGi 
<blueprint> XML is not supported"), messages);
+            assertTrue(messages.contains("camel-spring-xml"), messages);
+            assertTrue(context.getRouteDefinitions().isEmpty());
+        }
+    }
+
+    @Test
+    public void testLegacyCamelContextFails() throws Exception {
+        try (DefaultCamelContext context = new DefaultCamelContext()) {
+            // <camelContext> of Spring XML inside <camel>
+            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
+                    "/org/apache/camel/dsl/xml/io/legacy-camel-context.xml");
+
+            Exception e = assertThrows(Exception.class, () -> 
PluginHelper.getRoutesLoader(context).loadRoutes(resource));
+            String messages = messages(e);
+            assertTrue(messages.contains("Unsupported element 
<camelContext>"), messages);
+            assertTrue(context.getRouteDefinitions().isEmpty());
+        }
+    }
+
+    private static String messages(Throwable e) {
+        StringBuilder sb = new StringBuilder();
+        for (Throwable t = e; t != null; t = t.getCause()) {
+            sb.append(t.getMessage()).append('\n');
+        }
+        return sb.toString();
+    }
+
+}
diff --git 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLoadAppTest.java
 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLoadAppTest.java
index 60e49184b919..889393e4a55f 100644
--- 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLoadAppTest.java
+++ 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlLoadAppTest.java
@@ -436,27 +436,6 @@ public class XmlLoadAppTest {
         }
     }
 
-    @Test
-    public void testLoadAppWithDataFormatSpring() throws Exception {
-        try (DefaultCamelContext context = new DefaultCamelContext()) {
-            context.start();
-
-            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
-                    "/org/apache/camel/dsl/xml/io/camel-app14.xml");
-
-            PluginHelper.getRoutesLoader(context).loadRoutes(resource);
-
-            // test that loaded route works
-            MockEndpoint bar = context.getEndpoint("mock:result", 
MockEndpoint.class);
-
-            Base64 codec = new Base64(40, new byte[] { '\r', '\n' }, true);
-            byte[] encoded = codec.encode("Hi World".getBytes());
-            bar.expectedBodiesReceived(encoded);
-            context.createProducerTemplate().sendBody("direct:start", "Hi 
World");
-            bar.assertIsSatisfied();
-        }
-    }
-
     @Test
     public void testLoadAppWithDataFormat() throws Exception {
         try (DefaultCamelContext context = new DefaultCamelContext()) {
diff --git 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlSpringBeansLoadTest.java
 
b/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlSpringBeansLoadTest.java
deleted file mode 100644
index c5f7ba6b226d..000000000000
--- 
a/dsl/camel-xml-io-dsl/src/test/java/org/apache/camel/dsl/xml/io/XmlSpringBeansLoadTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.dsl.xml.io;
-
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.support.PluginHelper;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-public class XmlSpringBeansLoadTest {
-
-    @Test
-    public void testLoadRoutesBuilderFromXml() throws Exception {
-        try (DefaultCamelContext context = new DefaultCamelContext()) {
-            // load spring XML <beans> with embedded <camelContext>
-            Resource resource = 
PluginHelper.getResourceLoader(context).resolveResource(
-                    "/org/apache/camel/dsl/xml/io/springBeans.xml");
-
-            Assertions.assertDoesNotThrow(() -> {
-                // should be able to parse the file and not fail (camel-jbang 
supports creating spring beans)
-                PluginHelper.getRoutesLoader(context).loadRoutes(resource);
-            });
-        }
-    }
-
-}
diff --git 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/blueprintRests.xml
 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/blueprintRests.xml
deleted file mode 100644
index 893873112066..000000000000
--- 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/blueprintRests.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-           xsi:schemaLocation="
-           http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
-
-    <camelContext id="myCamel" 
xmlns="http://camel.apache.org/schema/blueprint";>
-        <rest path="/user" consumes="application/json" 
produces="application/json">
-            <get path="/{id}">
-                <param name="id" type="path" description="The id of the user 
to get" dataType="integer"/>
-                <responseMessage message="The user that was found"/>
-                <responseMessage code="404" message="User not found"/>
-                <to uri="direct:getUser"/>
-            </get>
-            <put>
-                <param name="body" type="body" description="The user to update 
or create"/>
-                <to uri="stub:userService?method=updateUser"/>
-            </put>
-            <get path="/findAll">
-                <responseMessage message="All the users"/>
-                <to uri="stub:userService?method=listUsers"/>
-            </get>
-        </rest>
-
-        <rest path="/echo">
-            <get path="/ping">
-                <to uri="direct:echo"/>
-            </get>
-        </rest>
-
-        <route>
-            <from uri="direct:getUser"/>
-            <to uri="stub:userService?method=getUser(${header.id})"/>
-            <filter>
-                <simple>${body} == null</simple>
-                <setHeader name="Exchange.HTTP_RESPONSE_CODE">
-                    <constant>404</constant>
-                </setHeader>
-            </filter>
-        </route>
-        <route>
-            <from uri="direct:echo"/>
-            <setBody>
-                <constant>pong</constant>
-            </setBody>
-        </route>
-
-    </camelContext>
-
-</blueprint>
diff --git 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/blueprintRoutes.xml
 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-blueprint.xml
similarity index 100%
rename from 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/blueprintRoutes.xml
rename to 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-blueprint.xml
diff --git 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/camel-app14.xml
 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-camel-context.xml
similarity index 91%
rename from 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/camel-app14.xml
rename to 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-camel-context.xml
index 55d0c5aa9867..7067ebcc2e92 100644
--- 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/camel-app14.xml
+++ 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-camel-context.xml
@@ -17,9 +17,9 @@
     limitations under the License.
 
 -->
-<camel xmlns:s="http://www.springframework.org/schema/beans";>
+<camel>
 
-    <!-- embed Camel with routes -->
+    <!-- legacy Spring XML camelContext inside camel is not supported -->
     <camelContext xmlns="http://camel.apache.org/schema/spring";>
         <dataFormats>
             <base64 id="myBase" lineLength="40" urlSafe="true"/>
diff --git 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-security-policy.xml
 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-spring-beans-in-camel.xml
similarity index 81%
rename from 
dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-security-policy.xml
rename to 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-spring-beans-in-camel.xml
index 870a7d8075c7..8144953c26aa 100644
--- 
a/dsl/camel-kamelet-main/src/test/resources/org/apache/camel/main/xml/spring-security-policy.xml
+++ 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-spring-beans-in-camel.xml
@@ -17,17 +17,17 @@
     limitations under the License.
 
 -->
-<camel>
+<camel xmlns="http://camel.apache.org/schema/xml-io";>
 
     <beans xmlns="http://www.springframework.org/schema/beans";>
-        <bean id="myClient" class="org.apache.camel.main.app.MyTlsClient">
-            <property name="trustAllCertificates" value="true"/>
+        <bean id="messageString" class="java.lang.String">
+            <constructor-arg index="0" value="Hello"/>
         </bean>
     </beans>
 
-    <route id="security-policy-spring">
+    <route id="my-route">
         <from uri="direct:start"/>
-        <to uri="mock:result"/>
+        <to uri="mock:finish"/>
     </route>
 
 </camel>
diff --git 
a/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/springBeans.xml
 
b/dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-spring-beans.xml
similarity index 100%
rename from 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/springBeans.xml
rename to 
dsl/camel-xml-io-dsl/src/test/resources/org/apache/camel/dsl/xml/io/legacy-spring-beans.xml
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/model-parser.vm
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/model-parser.vm
index 7180dac562c9..ffb81ec5373e 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/model-parser.vm
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/model-parser.vm
@@ -444,7 +444,8 @@ ${indent}        }##
                     *#noValueHandler()##
                 #end
             #end
-            #if( !$externals.empty )#*
+            #if( !$externals.empty || $name == "BeansDefinition" )#*
+                BeansDefinition (<camel>) also passes the end tag of the 
<dataFormats> wrapper through
                 *#, true##
             #end#*
             *#);
@@ -453,7 +454,7 @@ ${indent}        }##
     #end
     #if( $name == "BeansDefinition" || $name == "ApplicationDefinition" )
     public Optional<${name}> parse${name}() throws IOException, 
XmlPullParserException {
-        String tag = getNextTag("beans", "blueprint", "camel");
+        String tag = getNextTag("beans", "camel");
         if (tag != null) {
             return Optional.of(doParse${name}());
         }

Reply via email to