This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 30af0b5ff39 CAMEL-27061, CAMEL-27081: camel-spring-boot - an option
under a removed or renamed prefix, or a camel.main property that is not an
option, is logged at startup with its replacement (#2102)
30af0b5ff39 is described below
commit 30af0b5ff398c988be72e05327b2e22ef9269daf
Author: Federico Mariani <[email protected]>
AuthorDate: Tue Nov 17 11:56:03 2026 +0100
CAMEL-27061, CAMEL-27081: camel-spring-boot - an option under a removed or
renamed prefix, or a camel.main property that is not an option, is logged at
startup with its replacement (#2102)
* CAMEL-27061: camel-spring-boot - an option under the removed
camel.springboot. or camel.component.servlet.mapping. prefix is logged at
startup with its replacement
Spring Boot ignores a property below a bound prefix when no field matches
it,
so the camel.springboot.* options (removed in 4.13) and the
camel.component.servlet.mapping.* options (renamed to
camel.servlet.mapping.*
in 3.10) had no effect and nothing was logged.
CamelAutoConfiguration and ServletMappingAutoConfiguration now log a WARN at
startup for each such property, with where it is set and the option to use
instead (camel.main.*, camel.main.run-controller, camel.routecontroller.*,
camel.servlet.mapping.*). camel.springboot.lenient-configuration-binding is
still read and is not logged. The check is in the new
RemovedPropertiesHelper.
The camel-mcp-server-starter tests set camel.main.run-controller instead of
the removed camel.springboot.main-run-controller.
* CAMEL-27061: camel-spring-boot - an option under the other renamed
starter prefixes is logged at startup with its replacement
The upgrade guides list more starter prefixes that were renamed or
removed. Spring Boot does not bind an option under them, so it has no
effect and nothing is logged.
The auto-configuration that reads the new prefix now logs a WARN for each
such option, with the option to use instead:
-
camel.component.{consul,file,jgroups.raft,kubernetes,zookeeper}.cluster.service.*
(now camel.cluster.*), in the cluster service starters
- camel.service.lra.* (now camel.lra.*), in camel-lra-starter
- camel.component.undertow.spring.security.* (now
camel.security.undertow.*),
in camel-undertow-spring-security-starter. Its startup error for a
missing provider now names the new prefix.
- camel.supervising.controller.* (now camel.routecontroller.*),
camel.dataformat.securexml.* and camel.dataformat.yaml-snakeyaml.*
(now xml-security and snake-yaml), in CamelAutoConfiguration
- camel.health.components-enabled (now camel.health.producers-enabled)
and camel.health.config[id].* (now camel.health.exclude-pattern), in
CamelHealthCheckAutoConfiguration
camel.springboot.xml-routes, xml-rests and xml-route-templates are now
reported with camel.main.routes-include-pattern.
RemovedPropertiesHelper.warnRenamedProperties maps an option to the
option of the same name under the new prefix. The servlet mapping check
uses it too. The Spring Boot page lists the renamed prefixes.
* CAMEL-27081: camel-spring-boot - a camel.main option that Camel moved, or
a camel.main property that is not an option, is logged at startup
Spring Boot ignores a property below camel.main when the bound class has
no field for it. A camel.main option that Camel moved to another group,
an option of Camel Main standalone (such as camel.main.base-package-scan)
or a typo therefore had no effect, and nothing was logged.
CamelAutoConfiguration now logs a WARN at startup for each such property.
The options that Camel moved are logged with the option to use instead:
- camel.main.xml-routes, xml-rests, xml-route-templates (3.8):
camel.main.routes-include-pattern
- camel.main.debugging (4.2): camel.debug.enabled
- camel.main.route-controller-* (4.4): camel.routecontroller.*
- camel.main.backlog-tracing* (4.5): camel.trace.*
- camel.main.error-registry-* (4.21): camel.errorregistry.*
The camel.springboot.* check maps to them too, such as
camel.springboot.backlog-tracing to camel.trace.enabled.
A property is an option when its first name element is a property of the
class bound to camel.main, in any relaxed form, so map options such as
camel.main.global-options[key] are options too. camel.main.type-conversion
is read by TypeConversionConfiguration and is not logged. As Spring Boot
does for unknown fields, the environment variables and the system
properties are checked for the moved options only, as the name of an
environment variable cannot tell a dash from a dot.
The check is RemovedPropertiesHelper.warnUnboundProperties. The Spring
Boot page lists the moved camel.main options.
---
.../ConsulClusterServiceAutoConfiguration.java | 8 +-
.../ConsulClusterServiceRenamedPropertiesTest.java | 87 ++++
.../FileLockClusterServiceAutoConfiguration.java | 8 +-
.../FileClusterServiceRenamedPropertiesTest.java | 87 ++++
...JGroupsRaftClusterServiceAutoConfiguration.java | 8 +-
...upsRaftClusterServiceRenamedPropertiesTest.java | 87 ++++
.../KubernetesClusterServiceAutoConfiguration.java | 8 +-
...ernetesClusterServiceRenamedPropertiesTest.java | 87 ++++
.../springboot/LraServiceAutoConfiguration.java | 7 +-
.../LraServiceRenamedPropertiesTest.java | 93 ++++
.../SpringBootMcpServerCustomTransportTest.java | 2 +-
...SpringBootMcpServerOriginConfigurationTest.java | 2 +-
.../mcp/server/SpringBootMcpServerStdioTest.java | 2 +-
.../mcp/server/SpringBootMcpServerTest.java | 2 +-
.../ServletMappingAutoConfiguration.java | 15 +-
.../ServletMappingRemovedPropertiesTest.java | 138 ++++++
.../src/main/docs/undertow-spring-security.json | 2 +-
.../boot/UndertowSpringSecurityConfiguration.java | 2 +-
.../boot/UndertowSpringSecurityCustomizer.java | 11 +-
...ndertowSpringSecurityRenamedPropertiesTest.java | 99 +++++
.../ZooKeeperClusterServiceAutoConfiguration.java | 8 +-
...oKeeperClusterServiceRenamedPropertiesTest.java | 87 ++++
.../src/main/docs/spring-boot.adoc | 74 ++++
.../camel/spring/boot/CamelAutoConfiguration.java | 104 +++++
.../health/CamelHealthCheckAutoConfiguration.java | 18 +
.../spring/boot/util/RemovedPropertiesHelper.java | 268 ++++++++++++
.../spring/boot/RemovedPropertiesWarningTest.java | 485 +++++++++++++++++++++
.../pages/starters/undertow-spring-security.adoc | 2 +-
28 files changed, 1786 insertions(+), 15 deletions(-)
diff --git
a/components-starter/camel-consul-cluster-service-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java
b/components-starter/camel-consul-cluster-service-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java
index 5c24155a763..dda524778bb 100644
---
a/components-starter/camel-consul-cluster-service-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java
+++
b/components-starter/camel-consul-cluster-service-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java
@@ -20,10 +20,12 @@ import org.apache.camel.cluster.CamelClusterService;
import org.apache.camel.component.consul.cluster.ConsulClusterService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
import java.util.Optional;
@@ -34,8 +36,12 @@ public class ConsulClusterServiceAutoConfiguration {
private final ConsulClusterServiceConfiguration configuration;
- public
ConsulClusterServiceAutoConfiguration(ConsulClusterServiceConfiguration
configuration) {
+ public
ConsulClusterServiceAutoConfiguration(ConsulClusterServiceConfiguration
configuration,
+ Environment environment) {
this.configuration = configuration;
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.consul.cluster.service",
+ "camel.cluster.consul", "3.10",
ConsulClusterServiceConfiguration.class);
}
@Bean(name = "consul-cluster-service")
diff --git
a/components-starter/camel-consul-cluster-service-starter/src/test/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceRenamedPropertiesTest.java
b/components-starter/camel-consul-cluster-service-starter/src/test/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..f4e061f9435
--- /dev/null
+++
b/components-starter/camel-consul-cluster-service-starter/src/test/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceRenamedPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.consul.springboot.cluster;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.component.consul.cluster.ConsulClusterService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The Consul cluster service options were named
<tt>camel.component.consul.cluster.service.*</tt> before Camel 3.10,
+ * and are <tt>camel.cluster.consul.*</tt> since. An option under the old
prefix is not bound, and is logged at WARN
+ * with the option to use instead.
+ */
+public class ConsulClusterServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(ConsulClusterServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+
runner.withPropertyValues("camel.component.consul.cluster.service.id=old-id").run(context
-> {
+
assertThat(context.getBean(ConsulClusterService.class).getId()).as("the old
option is not bound")
+ .isNotEqualTo("old-id");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.consul.cluster.service.id "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.cluster.consul.id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+
runner.withPropertyValues("camel.cluster.consul.id=new-id").run(context -> {
+
assertThat(context.getBean(ConsulClusterService.class).getId()).isEqualTo("new-id");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-file-cluster-service-starter/src/main/java/org/apache/camel/component/file/springboot/cluster/FileLockClusterServiceAutoConfiguration.java
b/components-starter/camel-file-cluster-service-starter/src/main/java/org/apache/camel/component/file/springboot/cluster/FileLockClusterServiceAutoConfiguration.java
index dc563483637..e83c3e28d4f 100644
---
a/components-starter/camel-file-cluster-service-starter/src/main/java/org/apache/camel/component/file/springboot/cluster/FileLockClusterServiceAutoConfiguration.java
+++
b/components-starter/camel-file-cluster-service-starter/src/main/java/org/apache/camel/component/file/springboot/cluster/FileLockClusterServiceAutoConfiguration.java
@@ -24,10 +24,12 @@ import
org.apache.camel.component.file.cluster.FileLockClusterService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
import org.apache.camel.spring.boot.cluster.TimePatternConverter;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
@AutoConfiguration(before = { ClusteredRouteControllerAutoConfiguration.class,
CamelAutoConfiguration.class })
@ConditionalOnProperty(prefix = "camel.cluster.file", name = "enabled",
matchIfMissing = true)
@@ -36,8 +38,12 @@ public class FileLockClusterServiceAutoConfiguration {
private final FileLockClusterServiceConfiguration configuration;
- public
FileLockClusterServiceAutoConfiguration(FileLockClusterServiceConfiguration
configuration) {
+ public
FileLockClusterServiceAutoConfiguration(FileLockClusterServiceConfiguration
configuration,
+ Environment environment) {
this.configuration = configuration;
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.file.cluster.service",
+ "camel.cluster.file", "3.10",
FileLockClusterServiceConfiguration.class);
}
@Bean(name = "file-lock-cluster-service")
diff --git
a/components-starter/camel-file-cluster-service-starter/src/test/java/org/apache/camel/component/file/springboot/cluster/FileClusterServiceRenamedPropertiesTest.java
b/components-starter/camel-file-cluster-service-starter/src/test/java/org/apache/camel/component/file/springboot/cluster/FileClusterServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..c3d0e5becda
--- /dev/null
+++
b/components-starter/camel-file-cluster-service-starter/src/test/java/org/apache/camel/component/file/springboot/cluster/FileClusterServiceRenamedPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.springboot.cluster;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.component.file.cluster.FileLockClusterService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The file cluster service options were named
<tt>camel.component.file.cluster.service.*</tt> before Camel 3.10, and
+ * are <tt>camel.cluster.file.*</tt> since. An option under the old prefix is
not bound, and is logged at WARN with the
+ * option to use instead.
+ */
+public class FileClusterServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(FileLockClusterServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+
runner.withPropertyValues("camel.component.file.cluster.service.id=old-id").run(context
-> {
+
assertThat(context.getBean(FileLockClusterService.class).getId()).as("the old
option is not bound")
+ .isNotEqualTo("old-id");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.file.cluster.service.id "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.cluster.file.id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+ runner.withPropertyValues("camel.cluster.file.id=new-id").run(context
-> {
+
assertThat(context.getBean(FileLockClusterService.class).getId()).isEqualTo("new-id");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-jgroups-raft-cluster-service-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceAutoConfiguration.java
b/components-starter/camel-jgroups-raft-cluster-service-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceAutoConfiguration.java
index 5b8f3bc7f2c..269bf59d51c 100644
---
a/components-starter/camel-jgroups-raft-cluster-service-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceAutoConfiguration.java
+++
b/components-starter/camel-jgroups-raft-cluster-service-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceAutoConfiguration.java
@@ -20,10 +20,12 @@ import org.apache.camel.cluster.CamelClusterService;
import
org.apache.camel.component.jgroups.raft.cluster.JGroupsRaftClusterService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
import java.util.Optional;
@@ -34,8 +36,12 @@ public class JGroupsRaftClusterServiceAutoConfiguration {
private final JGroupsRaftClusterServiceConfiguration configuration;
- public
JGroupsRaftClusterServiceAutoConfiguration(JGroupsRaftClusterServiceConfiguration
configuration) {
+ public
JGroupsRaftClusterServiceAutoConfiguration(JGroupsRaftClusterServiceConfiguration
configuration,
+ Environment environment) {
this.configuration = configuration;
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.jgroups.raft.cluster.service",
+ "camel.cluster.jgroups-raft", "3.10",
JGroupsRaftClusterServiceConfiguration.class);
}
@Bean(name = "jgroups-raft-cluster-service")
diff --git
a/components-starter/camel-jgroups-raft-cluster-service-starter/src/test/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceRenamedPropertiesTest.java
b/components-starter/camel-jgroups-raft-cluster-service-starter/src/test/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..33434f0ed4a
--- /dev/null
+++
b/components-starter/camel-jgroups-raft-cluster-service-starter/src/test/java/org/apache/camel/component/jgroups/raft/springboot/cluster/JGroupsRaftClusterServiceRenamedPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jgroups.raft.springboot.cluster;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import
org.apache.camel.component.jgroups.raft.cluster.JGroupsRaftClusterService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The JGroups Raft cluster service options were named
<tt>camel.component.jgroups.raft.cluster.service.*</tt> before
+ * Camel 3.10, and are <tt>camel.cluster.jgroups-raft.*</tt> since. An option
under the old prefix is not bound, and is
+ * logged at WARN with the option to use instead.
+ */
+public class JGroupsRaftClusterServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(JGroupsRaftClusterServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+
runner.withPropertyValues("camel.component.jgroups.raft.cluster.service.id=old-id").run(context
-> {
+
assertThat(context.getBean(JGroupsRaftClusterService.class).getId()).as("the
old option is not bound")
+ .isNotEqualTo("old-id");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.jgroups.raft.cluster.service.id "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.cluster.jgroups-raft.id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+
runner.withPropertyValues("camel.cluster.jgroups-raft.id=new-id").run(context
-> {
+
assertThat(context.getBean(JGroupsRaftClusterService.class).getId()).isEqualTo("new-id");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-kubernetes-cluster-service-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java
b/components-starter/camel-kubernetes-cluster-service-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java
index 6d692fb3b44..a9dd5b92059 100644
---
a/components-starter/camel-kubernetes-cluster-service-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java
+++
b/components-starter/camel-kubernetes-cluster-service-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java
@@ -22,10 +22,12 @@ import org.apache.camel.cluster.CamelClusterService;
import org.apache.camel.component.kubernetes.cluster.KubernetesClusterService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
@AutoConfiguration(before = { ClusteredRouteControllerAutoConfiguration.class,
CamelAutoConfiguration.class })
@ConditionalOnProperty(prefix = "camel.cluster.kubernetes", name = "enabled",
matchIfMissing = true)
@@ -34,8 +36,12 @@ public class KubernetesClusterServiceAutoConfiguration {
private final KubernetesClusterServiceConfiguration configuration;
- public
KubernetesClusterServiceAutoConfiguration(KubernetesClusterServiceConfiguration
configuration) {
+ public
KubernetesClusterServiceAutoConfiguration(KubernetesClusterServiceConfiguration
configuration,
+ Environment environment) {
this.configuration = configuration;
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.kubernetes.cluster.service",
+ "camel.cluster.kubernetes", "3.10",
KubernetesClusterServiceConfiguration.class);
}
@Bean(name = "kubernetes-cluster-service")
diff --git
a/components-starter/camel-kubernetes-cluster-service-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceRenamedPropertiesTest.java
b/components-starter/camel-kubernetes-cluster-service-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..96f1eebcb56
--- /dev/null
+++
b/components-starter/camel-kubernetes-cluster-service-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceRenamedPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.kubernetes.springboot.cluster;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.component.kubernetes.cluster.KubernetesClusterService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The Kubernetes cluster service options were named
<tt>camel.component.kubernetes.cluster.service.*</tt> before Camel
+ * 3.10, and are <tt>camel.cluster.kubernetes.*</tt> since. An option under
the old prefix is not bound, and is logged
+ * at WARN with the option to use instead.
+ */
+public class KubernetesClusterServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(KubernetesClusterServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+
runner.withPropertyValues("camel.component.kubernetes.cluster.service.id=old-id").run(context
-> {
+
assertThat(context.getBean(KubernetesClusterService.class).getId()).as("the old
option is not bound")
+ .isNotEqualTo("old-id");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.kubernetes.cluster.service.id "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.cluster.kubernetes.id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+
runner.withPropertyValues("camel.cluster.kubernetes.id=new-id").run(context -> {
+
assertThat(context.getBean(KubernetesClusterService.class).getId()).isEqualTo("new-id");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java
b/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java
index d3c74cb391b..169f4cb4516 100644
---
a/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java
+++
b/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java
@@ -22,12 +22,14 @@ import org.apache.camel.service.lra.LRASagaService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
+import org.springframework.core.env.Environment;
@AutoConfiguration(after = CamelAutoConfiguration.class)
@Conditional({ ConditionalOnCamelContextAndAutoConfigurationBeans.class,
@@ -37,8 +39,11 @@ public class LraServiceAutoConfiguration {
private final CamelContext camelContext;
- public LraServiceAutoConfiguration(CamelContext camelContext) {
+ public LraServiceAutoConfiguration(CamelContext camelContext, Environment
environment) {
this.camelContext = camelContext;
+ // the options were renamed in Camel 3.4, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.service.lra", "camel.lra", "3.4",
+ LraServiceConfiguration.class);
}
static class GroupConditions extends GroupCondition {
diff --git
a/components-starter/camel-lra-starter/src/test/java/org/apache/camel/service/lra/springboot/LraServiceRenamedPropertiesTest.java
b/components-starter/camel-lra-starter/src/test/java/org/apache/camel/service/lra/springboot/LraServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..f530e85f254
--- /dev/null
+++
b/components-starter/camel-lra-starter/src/test/java/org/apache/camel/service/lra/springboot/LraServiceRenamedPropertiesTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.service.lra.springboot;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.saga.CamelSagaService;
+import org.apache.camel.service.lra.LRASagaService;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The LRA options were named <tt>camel.service.lra.*</tt> before Camel 3.4,
and are <tt>camel.lra.*</tt> since. An
+ * option under the old prefix is not bound, and is logged at WARN with the
option to use instead.
+ */
+public class LraServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(CamelAutoConfiguration.class,
LraServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+ runner.withPropertyValues("camel.service.lra.enabled=true",
+
"camel.service.lra.coordinator-url=http://lra-coordinator:8080").run(context ->
{
+ assertThat(context).as("the old options are not
bound").doesNotHaveBean(CamelSagaService.class);
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.service.lra.enabled "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.lra.enabled instead");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.service.lra.coordinator-url "))
+ .singleElement().asString()
+ .contains("Use camel.lra.coordinator-url instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+ runner.withPropertyValues("camel.lra.enabled=true",
"camel.lra.coordinator-url=http://lra-coordinator:8080",
+
"camel.lra.local-participant-url=http://localhost:8080").run(context -> {
+
assertThat(context.getBean(LRASagaService.class).getCoordinatorUrl())
+ .isEqualTo("http://lra-coordinator:8080");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no
effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerCustomTransportTest.java
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerCustomTransportTest.java
index 7bbeae3cd9b..293d2ae8d16 100644
---
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerCustomTransportTest.java
+++
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerCustomTransportTest.java
@@ -61,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.main.banner-mode=off",
"spring.ai.mcp.server.protocol=STREAMABLE",
"camel.mcp-server.tags=custom-provider",
- "camel.springboot.main-run-controller=false"
+ "camel.main.run-controller=false"
})
public class SpringBootMcpServerCustomTransportTest {
diff --git
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerOriginConfigurationTest.java
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerOriginConfigurationTest.java
index 15e45d0b516..0f7c3457133 100644
---
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerOriginConfigurationTest.java
+++
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerOriginConfigurationTest.java
@@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.ai.mcp.server.protocol=STREAMABLE",
"camel.mcp-server.tags=origin-tests",
"camel.mcp-server.allowed-origins=https://trusted.example",
- "camel.springboot.main-run-controller=false"
+ "camel.main.run-controller=false"
})
public class SpringBootMcpServerOriginConfigurationTest {
diff --git
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStdioTest.java
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStdioTest.java
index 07140fb7e8c..7d73e98c42d 100644
---
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStdioTest.java
+++
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStdioTest.java
@@ -61,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
properties = {
"spring.main.banner-mode=off",
"camel.mcp-server.tags=stdio-conformance",
- "camel.springboot.main-run-controller=false" })
+ "camel.main.run-controller=false" })
public class SpringBootMcpServerStdioTest {
private static final PipedOutputStream TO_SERVER;
diff --git
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
index 1f3220a4cc7..769810022c0 100644
---
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
+++
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
@@ -90,7 +90,7 @@ import static org.awaitility.Awaitility.await;
"spring.ai.mcp.server.prompt-change-notification=true",
"camel.mcp-server.tags=conformance",
"camel.mcp-server.tool-timeout=2000",
- "camel.springboot.main-run-controller=false" })
+ "camel.main.run-controller=false" })
public class SpringBootMcpServerTest {
private static final String MCP_TEST_AUTHORIZATION = "Basic " +
Base64.getEncoder()
diff --git
a/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.java
b/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.java
index 268be1dab14..a387efb258a 100644
---
a/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.java
+++
b/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.servlet.springboot;
import org.apache.camel.CamelContext;
import org.apache.camel.component.servlet.CamelHttpTransportServlet;
import org.apache.camel.component.servlet.ServletComponent;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -29,6 +30,7 @@ import
org.springframework.boot.servlet.autoconfigure.MultipartProperties;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
+import org.springframework.core.env.Environment;
/**
* Servlet mapping auto-configuration.
@@ -54,7 +56,8 @@ public class ServletMappingAutoConfiguration {
*/
@Bean
ServletRegistrationBean
camelServletRegistrationBean(CamelHttpTransportServlet servlet,
- ServletMappingConfiguration config, MultipartProperties
multipartProperties) {
+ ServletMappingConfiguration config, MultipartProperties
multipartProperties, Environment environment) {
+ warnRemovedMappingProperties(environment);
ServletRegistrationBean mapping = new ServletRegistrationBean();
mapping.setServlet(servlet);
mapping.addUrlMappings(config.getContextPath());
@@ -66,6 +69,16 @@ public class ServletMappingAutoConfiguration {
return mapping;
}
+ /**
+ * Logs a WARN for each camel.component.servlet.mapping.* option the
application sets, with the option to use
+ * instead. These options were renamed to camel.servlet.mapping.* in Camel
3.10, and Spring Boot ignores the old
+ * names without a log line.
+ */
+ static void warnRemovedMappingProperties(Environment environment) {
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.servlet.mapping",
+ "camel.servlet.mapping", "3.10",
ServletMappingConfiguration.class);
+ }
+
/**
* Ensures the Camel Servlet component is automatic created if no custom
exists.
*/
diff --git
a/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingRemovedPropertiesTest.java
b/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingRemovedPropertiesTest.java
new file mode 100644
index 00000000000..895cc8cf535
--- /dev/null
+++
b/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingRemovedPropertiesTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.servlet.springboot;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.time.Duration;
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.server.context.WebServerApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The servlet mapping options were named
<tt>camel.component.servlet.mapping.*</tt> before Camel 3.10, and are
+ * <tt>camel.servlet.mapping.*</tt> since. An option under the old prefix is
not bound, and is logged at WARN when the
+ * application starts, with the option to use instead.
+ */
+public class ServletMappingRemovedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ @Configuration
+ @EnableAutoConfiguration
+ public static class App {
+ @Bean
+ RouteBuilder route() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ restConfiguration().component("servlet");
+ rest("/hello").get().to("direct:hello");
+ from("direct:hello").setBody(constant("hello"));
+ }
+ };
+ }
+ }
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ /**
+ * Starts the web application with the given properties. The log appender
is attached from an initializer, that is
+ * after Spring Boot has initialized the logging system, so it sees the
whole startup.
+ */
+ private ConfigurableApplicationContext run(String... properties) {
+ return new SpringApplicationBuilder(App.class)
+ .web(WebApplicationType.SERVLET)
+ .properties("server.port=0")
+ .properties(properties)
+ .initializers(c -> rootLogger().addAppender(logs))
+ .run();
+ }
+
+ private static HttpResponse<String> get(ConfigurableApplicationContext
ctx, String path) throws Exception {
+ int port = ((WebServerApplicationContext)
ctx).getWebServer().getPort();
+ HttpClient client =
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).build();
+ HttpRequest request =
HttpRequest.newBuilder(URI.create("http://localhost:" + port + path))
+ .timeout(Duration.ofSeconds(10)).GET().build();
+ return client.send(request, HttpResponse.BodyHandlers.ofString());
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldContextPathIsReportedWithItsReplacement() throws Exception {
+ try (ConfigurableApplicationContext ctx =
run("camel.component.servlet.mapping.context-path=/api/*")) {
+ assertThat(get(ctx, "/api/hello").statusCode()).as("the old option
does not move the servlet")
+ .isEqualTo(404);
+ HttpResponse<String> camel = get(ctx, "/camel/hello");
+ assertThat(camel.statusCode()).as("the servlet stays at the
default /camel/*").isEqualTo(200);
+ assertThat(camel.body()).isEqualTo("hello");
+
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.servlet.mapping.context-path "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.servlet.mapping.context-path
instead");
+ }
+ }
+
+ @Test
+ public void contextPathMovesTheServletAndIsNotReported() throws Exception {
+ try (ConfigurableApplicationContext ctx =
run("camel.servlet.mapping.context-path=/api/*")) {
+ HttpResponse<String> api = get(ctx, "/api/hello");
+ assertThat(api.statusCode()).isEqualTo(200);
+ assertThat(api.body()).isEqualTo("hello");
+ assertThat(get(ctx, "/camel/hello").statusCode()).isEqualTo(404);
+
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ }
+ }
+}
diff --git
a/components-starter/camel-undertow-spring-security-starter/src/main/docs/undertow-spring-security.json
b/components-starter/camel-undertow-spring-security-starter/src/main/docs/undertow-spring-security.json
index 304c56c315b..dbd255ccfd0 100644
---
a/components-starter/camel-undertow-spring-security-starter/src/main/docs/undertow-spring-security.json
+++
b/components-starter/camel-undertow-spring-security-starter/src/main/docs/undertow-spring-security.json
@@ -16,7 +16,7 @@
{
"name": "camel.security.undertow.keycloak",
"type":
"org.apache.camel.undertow.spring.boot.providers.KeycloakProviderConfiguration",
- "description": "Properties defined for keycloak provider. Value is
gathered together from properties with prefix
\"camel.component.undertow.spring.security.keycloak\"",
+ "description": "Properties defined for keycloak provider. Value is
gathered together from properties with prefix
\"camel.security.undertow.keycloak\"",
"sourceType":
"org.apache.camel.undertow.spring.boot.UndertowSpringSecurityConfiguration"
},
{
diff --git
a/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityConfiguration.java
b/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityConfiguration.java
index 5c05fed5448..209953a16cf 100644
---
a/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityConfiguration.java
+++
b/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityConfiguration.java
@@ -32,7 +32,7 @@ public class UndertowSpringSecurityConfiguration {
/**
* Properties defined for keycloak provider. Value is gathered together
from properties with prefix
- * "camel.component.undertow.spring.security.keycloak"
+ * "camel.security.undertow.keycloak"
*/
private KeycloakProviderConfiguration keycloak;
diff --git
a/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityCustomizer.java
b/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityCustomizer.java
index 7320061ba6e..56791005188 100644
---
a/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityCustomizer.java
+++
b/components-starter/camel-undertow-spring-security-starter/src/main/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityCustomizer.java
@@ -28,12 +28,14 @@ import org.apache.camel.spi.ComponentCustomizer;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.undertow.spring.boot.providers.AbstractProviderConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import
org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
@@ -66,6 +68,12 @@ public class UndertowSpringSecurityCustomizer implements
ComponentCustomizer {
@Autowired
private DelegatingFilterProxyRegistrationBean
delegatingFilterProxyRegistrationBean;
+ public UndertowSpringSecurityCustomizer(Environment environment) {
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.undertow.spring.security",
+ "camel.security.undertow", "3.10",
UndertowSpringSecurityConfiguration.class);
+ }
+
@Override
public void configure(String name, Component target) {
UndertowComponent uc = (UndertowComponent) target;
@@ -158,7 +166,8 @@ public class UndertowSpringSecurityCustomizer implements
ComponentCustomizer {
if (definedProviders.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "Properties
camel.component.undertow.spring.security.provider.* are not defined. Allowed
providers are (%s)",
+ "No provider is configured: set the
camel.security.undertow.<provider>.* options, such as"
+ + " camel.security.undertow.keycloak.url.
Allowed providers are (%s)",
ProviderType.values()));
}
if (definedProviders.size() > 1) {
diff --git
a/components-starter/camel-undertow-spring-security-starter/src/test/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityRenamedPropertiesTest.java
b/components-starter/camel-undertow-spring-security-starter/src/test/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityRenamedPropertiesTest.java
new file mode 100644
index 00000000000..910c986b582
--- /dev/null
+++
b/components-starter/camel-undertow-spring-security-starter/src/test/java/org/apache/camel/undertow/spring/boot/UndertowSpringSecurityRenamedPropertiesTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.undertow.spring.boot;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import
org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
+import org.springframework.security.oauth2.jwt.JwtDecoder;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The provider options were named
<tt>camel.component.undertow.spring.security.*</tt> before Camel 3.10, and are
+ * <tt>camel.security.undertow.*</tt> since. An option under the old prefix is
not bound, and is logged at WARN with the
+ * option to use instead.
+ */
+public class UndertowSpringSecurityRenamedPropertiesTest {
+
+ private static final String OLD_PREFIX =
"camel.component.undertow.spring.security.";
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+ .withUserConfiguration(UndertowSpringSecurityCustomizer.class)
+ .withBean(DelegatingFilterProxyRegistrationBean.class,
+ () -> new
DelegatingFilterProxyRegistrationBean("springSecurityFilterChain"));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+ runner.withPropertyValues(OLD_PREFIX +
"keycloak.url=http://localhost:8080",
+ OLD_PREFIX + "keycloak.realm-id=my-realm",
+ OLD_PREFIX + "keycloak.client-id=camel-client").run(context ->
{
+ assertThat(context).as("no provider is bound from the old
options").hasFailed();
+ assertThat(context.getStartupFailure()).rootCause()
+
.hasMessageContaining("camel.security.undertow.keycloak");
+ assertThat(warnings()).filteredOn(m ->
m.contains(OLD_PREFIX + "keycloak.url "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use
camel.security.undertow.keycloak.url instead");
+ assertThat(warnings()).filteredOn(m ->
m.contains(OLD_PREFIX + "keycloak.realm-id "))
+ .singleElement().asString()
+ .contains("Use
camel.security.undertow.keycloak.realm-id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+
runner.withPropertyValues("camel.security.undertow.keycloak.url=http://localhost:8080",
+ "camel.security.undertow.keycloak.realm-id=my-realm",
+
"camel.security.undertow.keycloak.client-id=camel-client").run(context -> {
+
assertThat(context).hasNotFailed().hasSingleBean(JwtDecoder.class);
+ assertThat(warnings()).noneMatch(m -> m.contains("has no
effect"));
+ });
+ }
+}
diff --git
a/components-starter/camel-zookeeper-cluster-service-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java
b/components-starter/camel-zookeeper-cluster-service-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java
index 7fa7978c61c..4cffd0baf9b 100644
---
a/components-starter/camel-zookeeper-cluster-service-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java
+++
b/components-starter/camel-zookeeper-cluster-service-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java
@@ -20,10 +20,12 @@ import org.apache.camel.cluster.CamelClusterService;
import org.apache.camel.component.zookeeper.cluster.ZooKeeperClusterService;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
import java.util.Optional;
@@ -34,8 +36,12 @@ public class ZooKeeperClusterServiceAutoConfiguration {
private final ZooKeeperClusterServiceConfiguration configuration;
- public
ZooKeeperClusterServiceAutoConfiguration(ZooKeeperClusterServiceConfiguration
configuration) {
+ public
ZooKeeperClusterServiceAutoConfiguration(ZooKeeperClusterServiceConfiguration
configuration,
+ Environment environment) {
this.configuration = configuration;
+ // the options were renamed in Camel 3.10, and Spring Boot ignores the
old names without a log line
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.component.zookeeper.cluster.service",
+ "camel.cluster.zookeeper", "3.10",
ZooKeeperClusterServiceConfiguration.class);
}
@Bean(name = "zookeeper-cluster-service")
diff --git
a/components-starter/camel-zookeeper-cluster-service-starter/src/test/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceRenamedPropertiesTest.java
b/components-starter/camel-zookeeper-cluster-service-starter/src/test/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceRenamedPropertiesTest.java
new file mode 100644
index 00000000000..f2d4ab5dc79
--- /dev/null
+++
b/components-starter/camel-zookeeper-cluster-service-starter/src/test/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceRenamedPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.zookeeper.springboot.cluster;
+
+import java.util.List;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.component.zookeeper.cluster.ZooKeeperClusterService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The ZooKeeper cluster service options were named
<tt>camel.component.zookeeper.cluster.service.*</tt> before Camel
+ * 3.10, and are <tt>camel.cluster.zookeeper.*</tt> since. An option under the
old prefix is not bound, and is logged at
+ * WARN with the option to use instead.
+ */
+public class ZooKeeperClusterServiceRenamedPropertiesTest {
+
+ private final ListAppender<ILoggingEvent> logs = new ListAppender<>();
+
+ private final ApplicationContextRunner runner = new
ApplicationContextRunner()
+
.withConfiguration(AutoConfigurations.of(ZooKeeperClusterServiceAutoConfiguration.class));
+
+ @BeforeEach
+ public void startLogs() {
+ logs.start();
+ rootLogger().addAppender(logs);
+ }
+
+ @AfterEach
+ public void stopLogs() {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ @Test
+ public void oldPrefixIsReportedWithTheNewOption() {
+
runner.withPropertyValues("camel.component.zookeeper.cluster.service.id=old-id").run(context
-> {
+
assertThat(context.getBean(ZooKeeperClusterService.class).getId()).as("the old
option is not bound")
+ .isNotEqualTo("old-id");
+ assertThat(warnings()).filteredOn(m ->
m.contains("camel.component.zookeeper.cluster.service.id "))
+ .singleElement().asString()
+ .contains("has no effect")
+ .contains("Use camel.cluster.zookeeper.id instead");
+ });
+ }
+
+ @Test
+ public void newPrefixIsBoundAndNotReported() {
+
runner.withPropertyValues("camel.cluster.zookeeper.id=new-id").run(context -> {
+
assertThat(context.getBean(ZooKeeperClusterService.class).getId()).isEqualTo("new-id");
+ assertThat(warnings()).noneMatch(m -> m.contains("has no effect"));
+ });
+ }
+}
diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.adoc
b/core/camel-spring-boot/src/main/docs/spring-boot.adoc
index 3a83148fca1..4a44091bfb3 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.adoc
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.adoc
@@ -180,6 +180,80 @@ public class MyRouter extends RouteBuilder {
}
----
+=== Removed configuration prefixes
+
+The `camel.springboot.*` options were removed in Camel 4.13. Use the
`camel.main.*` option of the same name instead,
+such as `camel.main.name` for `camel.springboot.name`. The run controller
option is `camel.main.run-controller`, and
+the route controller options are under `camel.routecontroller.*`, such as
`camel.routecontroller.enabled`. Only
+`camel.springboot.lenient-configuration-binding` keeps its name.
+
+The options under the following prefixes were renamed. An option keeps its
name under the new prefix, such as
+`camel.cluster.file.root` for `camel.component.file.cluster.service.root`:
+
+[width="100%",cols="2m,2m,1,2",options="header"]
+|===
+| Old prefix | New prefix | Since | Starter
+| camel.supervising.controller | camel.routecontroller | 3.3 |
`camel-spring-boot-starter`
+| camel.service.lra | camel.lra | 3.4 | `camel-lra-starter`
+| camel.component.consul.cluster.service | camel.cluster.consul | 3.10 |
`camel-consul-cluster-service-starter`
+| camel.component.file.cluster.service | camel.cluster.file | 3.10 |
`camel-file-cluster-service-starter`
+| camel.component.jgroups.raft.cluster.service | camel.cluster.jgroups-raft |
3.10 | `camel-jgroups-raft-cluster-service-starter`
+| camel.component.kubernetes.cluster.service | camel.cluster.kubernetes | 3.10
| `camel-kubernetes-cluster-service-starter`
+| camel.component.zookeeper.cluster.service | camel.cluster.zookeeper | 3.10 |
`camel-zookeeper-cluster-service-starter`
+| camel.component.servlet.mapping | camel.servlet.mapping | 3.10 |
`camel-servlet-starter`
+| camel.component.undertow.spring.security | camel.security.undertow | 3.10 |
`camel-undertow-spring-security-starter`
+| camel.dataformat.securexml | camel.dataformat.xml-security | 3.15 |
`camel-spring-boot-starter`
+| camel.dataformat.yaml-snakeyaml | camel.dataformat.snake-yaml | 3.15 |
`camel-spring-boot-starter`
+|===
+
+The `camel.supervising.controller.default-back-off.*` options are
`camel.routecontroller.back-off-*`, such as
+`camel.routecontroller.back-off-delay`. The `camel.springboot.xml-routes`,
`camel.springboot.xml-rests` and
+`camel.springboot.xml-route-templates` options are replaced by
`camel.main.routes-include-pattern`.
+
+Two health check options were removed: `camel.health.components-enabled` is
`camel.health.producers-enabled` since
+Camel 4.0, and the `camel.health.config[id].*` options were replaced by
`camel.health.exclude-pattern` in Camel 3.16.
+
+The following `camel.main.*` options were moved to another group or replaced:
+
+[width="100%",cols="2m,2m,1",options="header"]
+|===
+| Old option | Option to use | Since
+| camel.main.xml-routes, camel.main.xml-rests, camel.main.xml-route-templates
| camel.main.routes-include-pattern | 3.8
+| camel.main.debugging | camel.debug.enabled | 4.2
+| camel.main.route-controller-* | camel.routecontroller.* | 4.4
+| camel.main.backlog-tracing, camel.main.backlog-tracing-standby,
camel.main.backlog-tracing-templates | camel.trace.enabled,
camel.trace.standby, camel.trace.trace-templates | 4.5
+| camel.main.error-registry-* | camel.errorregistry.* | 4.21
+|===
+
+The route controller and error registry options keep their name in the new
group, such as
+`camel.routecontroller.back-off-delay` for
`camel.main.route-controller-back-off-delay`. The exceptions are
+`camel.main.route-controller-supervise-enabled`, which is
`camel.routecontroller.enabled`, and
+`camel.main.error-registry-stack-trace-enabled`, which was removed. The
`camel.debug.*` options need the
+`camel-debug-starter`.
+
+Some options of Camel Main standalone are not options of Camel on Spring Boot,
such as `camel.main.base-package-scan`
+and `camel.main.routes-builder-classes`: Camel on Spring Boot uses the
`RouteBuilder` classes that are Spring beans.
+
+Spring Boot ignores a property that no configuration class binds, so an option
under one of these old prefixes has no
+effect. Camel logs a `WARN` at startup for each one, with the option to use
instead. The starter in the first table
+logs it, so the `WARN` shows only when that starter is on the classpath. For
example:
+
+[source,text]
+----
+Property camel.springboot.name (class path resource [application.properties] -
3:1) has no effect, as the camel.springboot. prefix was removed in Camel 4.13.
Use camel.main.name instead.
+----
+
+Camel also logs a `WARN` for any other `camel.main.*` property that is not an
option of Camel on Spring Boot, such as
+a typo or an option of Camel Main standalone. As Spring Boot does for the
properties it does not know, it does not
+check the environment variables and the system properties for these, as the
name of an environment variable cannot
+tell a dash from a dot. The old `camel.main.*` options of the table above are
logged from every property source, with
+the option to use instead:
+
+[source,text]
+----
+Property camel.main.backlog-tracing (class path resource
[application.properties] - 4:1) has no effect, as Camel on Spring Boot has no
camel.main option of this name. Use camel.trace.enabled instead.
+----
+
== Custom Camel context configuration
If you would like to perform some operations on `CamelContext` bean
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index 723a0197c72..a957329cd0c 100644
---
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -23,6 +23,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
+import java.util.function.Function;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
@@ -52,6 +54,9 @@ import org.apache.camel.spi.StartupConditionStrategy;
import org.apache.camel.spi.StartupStepRecorder;
import org.apache.camel.spi.VariableRepository;
import org.apache.camel.spi.VariableRepositoryFactory;
+import
org.apache.camel.spring.boot.errorregistry.CamelErrorRegistryConfigurationProperties;
+import
org.apache.camel.spring.boot.routecontroller.SupervisingRouteControllerConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.apache.camel.spring.spi.ApplicationContextBeanRepository;
import org.apache.camel.spring.spi.CamelBeanPostProcessor;
import org.apache.camel.support.DefaultRegistry;
@@ -136,6 +141,12 @@ public class CamelAutoConfiguration {
CamelConfigurationProperties config,
CamelSpringBootApplicationController controller) throws Exception {
+ // Spring Boot ignores the options under a removed or renamed prefix
without a log line
+ warnRemovedSpringbootProperties(applicationContext.getEnvironment());
+ warnRenamedProperties(applicationContext.getEnvironment());
+ // and a camel.main option that has no field, such as an option that
Camel moved, or a typo
+ warnUnboundMainProperties(applicationContext.getEnvironment());
+
// inject camel context on controller
CamelContextAware.trySetCamelContext(controller, camelContext);
@@ -246,6 +257,99 @@ public class CamelAutoConfiguration {
return camelContext;
}
+ /**
+ * Logs a WARN for each camel.springboot.* option the application sets,
with the option to use instead. The
+ * camel.springboot. prefix was removed in Camel 4.13, so these options
have no effect, except
+ * camel.springboot.lenient-configuration-binding which is still read.
+ */
+ static void warnRemovedSpringbootProperties(Environment environment) {
+ Map<String, String> main =
RemovedPropertiesHelper.dashedPropertyNames(CamelConfigurationProperties.Main.class);
+ Function<String, String> moved = movedMainOptions();
+ RemovedPropertiesHelper.warnRemovedProperties(environment,
"camel.springboot",
+ "the camel.springboot. prefix was removed in Camel 4.13",
Set.of("lenientconfigurationbinding"),
+ name -> {
+ if ("mainruncontroller".equals(name)) {
+ return "camel.main.run-controller";
+ }
+ if ("typeconversion".equals(name)) {
+ return "camel.main.type-conversion";
+ }
+ String option = main.get(name);
+ return option != null ? "camel.main." + option :
moved.apply(name);
+ });
+ }
+
+ /**
+ * Logs a WARN for each camel.main.* property the application sets that is
not an option of Camel on Spring Boot:
+ * an option that Camel moved, with the option to use instead, an option
of Camel Main standalone, such as
+ * camel.main.base-package-scan, or a typo. camel.main.type-conversion is
read by
+ * {@link TypeConversionConfiguration}.
+ */
+ static void warnUnboundMainProperties(Environment environment) {
+ RemovedPropertiesHelper.warnUnboundProperties(environment,
"camel.main",
+ CamelConfigurationProperties.Main.class,
Set.of("typeconversion"), movedMainOptions());
+ }
+
+ /**
+ * Gives the option to use instead of a camel.main option that Camel moved
or replaced, from its name in uniform
+ * form, or null: the debugger option (camel.debug.enabled since Camel
4.2), the route controller options
+ * (camel.routecontroller.* since Camel 4.4), the backlog tracer options
(camel.trace.* since Camel 4.5), the error
+ * registry options (camel.errorregistry.* since Camel 4.21), and the XML
routes, rests and route templates options
+ * (camel.main.routes-include-pattern since Camel 3.8).
+ */
+ static Function<String, String> movedMainOptions() {
+ Map<String, String> routeController = RemovedPropertiesHelper
+
.dashedPropertyNames(SupervisingRouteControllerConfiguration.class);
+ Map<String, String> errorRegistry = RemovedPropertiesHelper
+
.dashedPropertyNames(CamelErrorRegistryConfigurationProperties.class);
+ return name -> switch (name) {
+ // the option was camel.main.debugging, which the Camel 4.2
upgrade guide names camel.main.debugger
+ case "debugging", "debugger" -> "camel.debug.enabled";
+ case "backlogtracing" -> "camel.trace.enabled";
+ case "backlogtracingstandby" -> "camel.trace.standby";
+ case "backlogtracingtemplates" -> "camel.trace.trace-templates";
+ case "routecontrollersuperviseenabled" ->
"camel.routecontroller.enabled";
+ case "xmlroutes", "xmlrests", "xmlroutetemplates" ->
"camel.main.routes-include-pattern";
+ default -> {
+ String option = optionInGroup(name, "routecontroller",
"camel.routecontroller", routeController);
+ yield option != null
+ ? option : optionInGroup(name, "errorregistry",
"camel.errorregistry", errorRegistry);
+ }
+ };
+ }
+
+ /**
+ * The option of the same name in a group, such as
camel.routecontroller.back-off-delay for
+ * routecontrollerbackoffdelay, or null.
+ */
+ private static String optionInGroup(String name, String group, String
prefix, Map<String, String> options) {
+ String option = name.startsWith(group) ?
options.get(name.substring(group.length())) : null;
+ return option != null ? prefix + "." + option : null;
+ }
+
+ /**
+ * Logs a WARN for each option the application sets under a renamed
prefix, with the option to use instead: the
+ * camel.supervising.controller.* options (removed in Camel 3.3, now
camel.routecontroller.*), and the two data
+ * formats whose name changed in Camel 3.15 by more than a dash. Spring
Boot ignores the dashes, so the options of
+ * the other renamed data formats, such as camel.dataformat.zipfile.*, are
still bound.
+ */
+ static void warnRenamedProperties(Environment environment) {
+ Map<String, String> routeController = RemovedPropertiesHelper
+
.dashedPropertyNames(SupervisingRouteControllerConfiguration.class);
+ RemovedPropertiesHelper.warnRemovedProperties(environment,
"camel.supervising.controller",
+ "the camel.supervising.controller. prefix was removed in Camel
3.3", Set.of(),
+ name -> {
+ // default-back-off.delay is back-off-delay
+ String option = routeController
+ .get(name.startsWith("defaultbackoff") ?
name.substring("default".length()) : name);
+ return option != null ? "camel.routecontroller." + option
: null;
+ });
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.dataformat.securexml",
+ "camel.dataformat.xml-security", "3.15", null);
+ RemovedPropertiesHelper.warnRenamedProperties(environment,
"camel.dataformat.yaml-snakeyaml",
+ "camel.dataformat.snake-yaml", "3.15", null);
+ }
+
/**
* Collect all camel.main.* property names that the user has explicitly
configured
* so that ProfileConfigurer does not override them with profile defaults.
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
index 78b5f344250..623741341bc 100644
---
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckAutoConfiguration.java
@@ -16,11 +16,14 @@
*/
package org.apache.camel.spring.boot.actuate.health;
+import java.util.Set;
+
import org.apache.camel.CamelContext;
import org.apache.camel.health.HealthCheck;
import org.apache.camel.health.HealthCheckRegistry;
import org.apache.camel.health.HealthCheckRepository;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.util.RemovedPropertiesHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -32,6 +35,7 @@ import
org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.health.contributor.HealthIndicator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
@AutoConfiguration(after = CamelAutoConfiguration.class)
@ConditionalOnClass({ HealthIndicator.class })
@@ -48,6 +52,9 @@ public class CamelHealthCheckAutoConfiguration {
public HealthIndicator camelHealthCheckIndicator(ApplicationContext
applicationContext,
CamelContext camelContext, CamelHealthCheckConfigurationProperties
config) {
+ // Spring Boot ignores the removed camel.health options without a log
line
+ warnRemovedProperties(applicationContext.getEnvironment());
+
// auto-detect camel-health on classpath
HealthCheckRegistry hcr = camelContext.getCamelContextExtension()
.getContextPlugin(HealthCheckRegistry.class);
@@ -129,4 +136,15 @@ public class CamelHealthCheckAutoConfiguration {
return new CamelHealthCheckIndicator(applicationContext, camelContext,
config.getExposureLevel());
}
+ /**
+ * Logs a WARN for each removed camel.health option the application sets,
with the option to use instead.
+ */
+ static void warnRemovedProperties(Environment environment) {
+ RemovedPropertiesHelper.warnRemovedProperties(environment,
"camel.health.components-enabled",
+ "the option was renamed in Camel 4.0", Set.of(), name ->
"camel.health.producers-enabled");
+ RemovedPropertiesHelper.warnRemovedProperties(environment,
"camel.health.config",
+ "the configuration of the health checks by id was removed in
Camel 3.16", Set.of(),
+ name -> "camel.health.exclude-pattern");
+ }
+
}
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RemovedPropertiesHelper.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RemovedPropertiesHelper.java
new file mode 100644
index 00000000000..d14dc2c2c4b
--- /dev/null
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RemovedPropertiesHelper.java
@@ -0,0 +1,268 @@
+/*
+ * 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.spring.boot.util;
+
+import java.beans.PropertyDescriptor;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.boot.context.properties.bind.DataObjectPropertyName;
+import
org.springframework.boot.context.properties.source.ConfigurationProperty;
+import
org.springframework.boot.context.properties.source.ConfigurationPropertyName;
+import
org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form;
+import
org.springframework.boot.context.properties.source.ConfigurationPropertySource;
+import
org.springframework.boot.context.properties.source.ConfigurationPropertySources;
+import
org.springframework.boot.context.properties.source.IterableConfigurationPropertySource;
+import
org.springframework.boot.context.properties.source.UnboundElementsSourceFilter;
+import org.springframework.boot.origin.Origin;
+import org.springframework.boot.origin.PropertySourceOrigin;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.SystemEnvironmentPropertySource;
+
+/**
+ * Reports the configuration properties under a prefix that is no longer read,
or that the configuration class bound to
+ * their prefix has no option for.
+ * <p/>
+ * Spring Boot ignores a property below the prefix of a
<tt>@ConfigurationProperties</tt> class when the class has no
+ * field for it. A property whose prefix or option was removed or renamed in
an earlier release therefore has no
+ * effect, and nothing is logged about it.
+ */
+public final class RemovedPropertiesHelper {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(RemovedPropertiesHelper.class);
+
+ private static final UnboundElementsSourceFilter
UNKNOWN_PROPERTIES_SOURCES = new UnboundElementsSourceFilter();
+
+ private RemovedPropertiesHelper() {
+ }
+
+ /**
+ * Logs a WARN for each property below the given prefix, or named as the
prefix, that a property source of the
+ * environment holds, naming the property to use instead. A property set
in several property sources is logged
+ * once.
+ *
+ * @param environment
+ * the environment of the application
+ * @param prefix
+ * the prefix that is no longer read, such as
<tt>camel.springboot</tt>, or the name of a single
+ * property that is no longer read, such as
<tt>camel.health.components-enabled</tt>
+ * @param reason
+ * why the properties below the prefix have no effect,
such as <tt>the camel.springboot. prefix
+ * was removed in Camel 4.13</tt>
+ * @param stillRead
+ * the properties below the prefix that are still read,
which are not logged, by the part of
+ * their name below the prefix in uniform form (lower
case, without dashes and dots), such as
+ * <tt>lenientconfigurationbinding</tt>
+ * @param replacement
+ * gives the property to use instead from the part of
the name below the prefix in uniform form,
+ * such as <tt>mainruncontroller</tt>, or <tt>null</tt>
when there is none
+ */
+ public static void warnRemovedProperties(
+ Environment environment, String prefix, String reason, Set<String>
stillRead,
+ Function<String, String> replacement) {
+ warnProperties(environment, prefix, (source, relative) ->
stillRead.contains(uniformName(relative))
+ ? null : because(reason,
replacement.apply(uniformName(relative))));
+ }
+
+ /**
+ * Logs a WARN for each property below a prefix that was renamed, naming
the option of the same name below the new
+ * prefix. A property set in several property sources is logged once.
+ *
+ * @param environment
+ * the environment of the application
+ * @param prefix
+ * the prefix that is no longer read, such as
<tt>camel.component.file.cluster.service</tt>
+ * @param newPrefix
+ * the prefix the options were renamed to, such as
<tt>camel.cluster.file</tt>
+ * @param since
+ * the Camel version that renamed the prefix, such as
<tt>3.10</tt>
+ * @param type
+ * the configuration class bound to the new prefix,
whose properties are the options to use
+ * instead, or <tt>null</tt> when the options kept
their name
+ */
+ public static void warnRenamedProperties(
+ Environment environment, String prefix, String newPrefix, String
since, Class<?> type) {
+ Map<String, String> options = type != null ? dashedPropertyNames(type)
: null;
+ String reason = "the " + prefix + ". prefix was renamed to " +
newPrefix + ". in Camel " + since;
+ warnProperties(environment, prefix, (source, relative) -> {
+ if (relative.isEmpty()) {
+ return because(reason, newPrefix);
+ }
+ String option = options != null
+ ? options.get(relative.getElement(0, Form.UNIFORM))
+ :
DataObjectPropertyName.toDashedForm(relative.getElement(0, Form.ORIGINAL));
+ if (option == null) {
+ return because(reason, null);
+ }
+ String answer = newPrefix + "." + option;
+ if (relative.getNumberOfElements() > 1) {
+ // the keys of a map or the elements of a list, kept as they
are
+ String rest = relative.subName(1).toString();
+ answer += rest.startsWith("[") ? rest : "." + rest;
+ }
+ return because(reason, answer);
+ });
+ }
+
+ /**
+ * Logs a WARN for each property below the given prefix that no option of
the configuration class bound to the
+ * prefix binds, such as an option that Camel moved to another prefix, an
option of Camel Main standalone, or a
+ * typo. Spring Boot ignores such a property. A property set in several
property sources is logged once.
+ * <p/>
+ * An option that was moved is logged from every property source, with the
option to use instead. Any other
+ * property is logged only from the property sources that Spring Boot
checks for a configuration class that does
+ * not ignore unknown fields, and also not from the environment variables
under another name: the name of an
+ * environment variable cannot tell a dash from a dot, such as
<tt>CAMEL_MAIN_SHUTDOWN_TIMEOUT</tt> for
+ * <tt>camel.main.shutdown-timeout</tt>.
+ *
+ * @param environment
+ * the environment of the application
+ * @param prefix
+ * the prefix bound to the class, such as
<tt>camel.main</tt>
+ * @param type
+ * the configuration class bound to the prefix
+ * @param readElsewhere
+ * the properties below the prefix that are read
outside the class, by the part of their name
+ * below the prefix in uniform form (lower case,
without dashes and dots), such as
+ * <tt>typeconversion</tt>
+ * @param moved
+ * gives the property to use instead of an option
that was moved, from the part of its name
+ * below the prefix in uniform form, such as
<tt>camel.trace.enabled</tt> for
+ * <tt>backlogtracing</tt>, or <tt>null</tt> when it
is not such an option
+ */
+ public static void warnUnboundProperties(
+ Environment environment, String prefix, Class<?> type, Set<String>
readElsewhere,
+ Function<String, String> moved) {
+ Set<String> options = new HashSet<>(readElsewhere);
+ for (PropertyDescriptor pd : BeanUtils.getPropertyDescriptors(type)) {
+ if (!"class".equals(pd.getName())) {
+ options.add(pd.getName().toLowerCase(Locale.ROOT));
+ }
+ }
+ String reason = "Camel on Spring Boot has no " + prefix + " option of
this name";
+ warnProperties(environment, prefix, (source, relative) -> {
+ if (relative.isEmpty()) {
+ return null;
+ }
+ String name = uniformName(relative);
+ // a map option, such as camel.main.global-options[key], is bound
by its first element
+ if (options.contains(relative.getElement(0, Form.UNIFORM)) ||
options.contains(name)) {
+ return null;
+ }
+ String replacement = moved.apply(name);
+ if (replacement != null) {
+ return reason + ". Use " + replacement + " instead.";
+ }
+ return checksUnknownProperties(source) ? reason + "." : null;
+ });
+ }
+
+ /**
+ * The writable properties of the given class, by their name in uniform
form (lower case, without dashes), with
+ * their name in the dashed form of the Spring Boot configuration keys,
such as <tt>run-controller</tt>.
+ */
+ public static Map<String, String> dashedPropertyNames(Class<?> type) {
+ Map<String, String> answer = new HashMap<>();
+ for (PropertyDescriptor pd : BeanUtils.getPropertyDescriptors(type)) {
+ if (pd.getWriteMethod() != null) {
+ answer.put(pd.getName().toLowerCase(Locale.ROOT),
DataObjectPropertyName.toDashedForm(pd.getName()));
+ }
+ }
+ return answer;
+ }
+
+ /**
+ * Whether unknown properties are reported from the given property source:
the property sources that Spring Boot
+ * checks for a configuration class that does not ignore unknown fields,
except the environment variables under
+ * another name.
+ */
+ private static boolean checksUnknownProperties(ConfigurationPropertySource
source) {
+ return !(source.getUnderlyingSource() instanceof
SystemEnvironmentPropertySource)
+ && UNKNOWN_PROPERTIES_SOURCES.apply(source);
+ }
+
+ /**
+ * Why a property has no effect, with the property to use instead.
+ */
+ private static String because(String reason, String replacement) {
+ if (replacement != null) {
+ return reason + ". Use " + replacement + " instead.";
+ }
+ return reason + ", and there is no option of the same name to use
instead.";
+ }
+
+ /**
+ * Logs a WARN for each property below the given prefix, or named as the
prefix, that a property source of the
+ * environment holds.
+ *
+ * @param message
+ * gives, from the property source and the part of the name
below the prefix, why the property has
+ * no effect, such as <tt>the camel.springboot. prefix was
removed in Camel 4.13. Use camel.main.name
+ * instead.</tt>, or <tt>null</tt> when the property is read
+ */
+ private static void warnProperties(
+ Environment environment, String prefix,
+ BiFunction<ConfigurationPropertySource, ConfigurationPropertyName,
String> message) {
+ if (!(environment instanceof ConfigurableEnvironment)) {
+ return;
+ }
+ ConfigurationPropertyName prefixName =
ConfigurationPropertyName.of(prefix);
+ Set<ConfigurationPropertyName> reported = new HashSet<>();
+ for (ConfigurationPropertySource source :
ConfigurationPropertySources.get(environment)) {
+ if (!(source instanceof IterableConfigurationPropertySource
iterable)) {
+ continue;
+ }
+ List<ConfigurationPropertyName> names = iterable.stream()
+ .filter(name -> prefixName.equals(name) ||
prefixName.isAncestorOf(name)).toList();
+ for (ConfigurationPropertyName name : names) {
+ ConfigurationPropertyName relative =
name.subName(prefixName.getNumberOfElements());
+ String why = message.apply(source, relative);
+ if (why == null || !reported.add(name)) {
+ continue;
+ }
+ ConfigurationProperty property =
source.getConfigurationProperty(name);
+ Origin origin = property != null ? property.getOrigin() : null;
+ String key = name.toString();
+ String location = origin != null ? origin.toString() :
"unknown location";
+ if (origin instanceof PropertySourceOrigin pso) {
+ key = pso.getPropertyName();
+ location = pso.getOrigin() != null
+ ? pso.getOrigin().toString() : "property source "
+ pso.getPropertySource().getName();
+ }
+ LOG.warn("Property {} ({}) has no effect, as {}", key,
location, why);
+ }
+ }
+ }
+
+ private static String uniformName(ConfigurationPropertyName name) {
+ StringBuilder answer = new StringBuilder();
+ for (int i = 0; i < name.getNumberOfElements(); i++) {
+ answer.append(name.getElement(i, Form.UNIFORM));
+ }
+ return answer.toString();
+ }
+}
diff --git
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/RemovedPropertiesWarningTest.java
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/RemovedPropertiesWarningTest.java
new file mode 100644
index 00000000000..57e5681bedd
--- /dev/null
+++
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/RemovedPropertiesWarningTest.java
@@ -0,0 +1,485 @@
+/*
+ * 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.spring.boot;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.health.HealthCheckRegistry;
+import org.apache.camel.health.HealthCheckRepository;
+import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.properties.bind.BindException;
+import org.springframework.boot.context.properties.bind.BindHandler;
+import org.springframework.boot.context.properties.bind.Bindable;
+import org.springframework.boot.context.properties.bind.Binder;
+import
org.springframework.boot.context.properties.bind.UnboundConfigurationPropertiesException;
+import
org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler;
+import
org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
+import org.springframework.boot.json.JsonParserFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.StandardEnvironment;
+import org.springframework.core.env.SystemEnvironmentPropertySource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The properties under a prefix that was removed or renamed, such as
<tt>camel.springboot.</tt> (removed in Camel
+ * 4.13), and the <tt>camel.main.</tt> properties that are not an option, such
as <tt>camel.main.backlog-tracing</tt>
+ * (moved to <tt>camel.trace.enabled</tt> in Camel 4.5), are not bound. Each
one is logged at WARN when the application
+ * starts, with the property to use instead.
+ */
+public class RemovedPropertiesWarningTest {
+
+ @Configuration
+ @EnableAutoConfiguration
+ public static class App {
+ @Bean
+ RouteBuilder route() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:a").routeId("a").to("mock:b");
+ }
+ };
+ }
+ }
+
+ private static final class Started implements AutoCloseable {
+ private final ConfigurableApplicationContext ctx;
+ private final ListAppender<ILoggingEvent> logs;
+
+ Started(ConfigurableApplicationContext ctx,
ListAppender<ILoggingEvent> logs) {
+ this.ctx = ctx;
+ this.logs = logs;
+ }
+
+ CamelContext camel() {
+ return ctx.getBean(CamelContext.class);
+ }
+
+ List<String> warnings() {
+ return logs.list.stream().filter(e ->
e.getLevel().isGreaterOrEqual(Level.WARN))
+ .map(ILoggingEvent::getFormattedMessage).toList();
+ }
+
+ /**
+ * The single WARN that names the given property.
+ */
+ String warningAbout(String property) {
+ List<String> found = warnings().stream().filter(m ->
m.contains(property + " ")).toList();
+ assertEquals(1, found.size(), "one WARN about " + property + "
expected, the WARNs are: " + warnings());
+ return found.get(0);
+ }
+
+ @Override
+ public void close() {
+ try {
+ ctx.close();
+ } finally {
+ rootLogger().detachAppender(logs);
+ logs.stop();
+ }
+ }
+ }
+
+ private static Logger rootLogger() {
+ return (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ }
+
+ private static Started start(String... properties) {
+ return start(Map.of(), new String[0], properties);
+ }
+
+ /**
+ * Starts the application with the given environment variables, command
line arguments and properties. The log
+ * appender is attached from an initializer, that is after Spring Boot has
initialized the logging system, so it
+ * sees the whole startup.
+ */
+ private static Started start(Map<String, Object> environmentVariables,
String[] args, String... properties) {
+ ListAppender<ILoggingEvent> appender = new ListAppender<>();
+ appender.start();
+ ConfigurableApplicationContext ctx = new
SpringApplicationBuilder(App.class)
+ .web(WebApplicationType.NONE)
+ .properties(properties)
+ .initializers(c -> {
+ rootLogger().addAppender(appender);
+ if (!environmentVariables.isEmpty()) {
+ c.getEnvironment().getPropertySources().addFirst(new
SystemEnvironmentPropertySource(
+ "test-" +
StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
+ environmentVariables));
+ }
+ })
+ .run(args);
+ return new Started(ctx, appender);
+ }
+
+ @Test
+ public void environmentVariableIsReportedByItsName() {
+ try (Started app =
start(Map.of("CAMEL_SPRINGBOOT_MAIN_RUN_CONTROLLER", "true",
+ "CAMEL_SPRINGBOOT_LENIENT_CONFIGURATION_BINDING", "true"), new
String[0])) {
+ String warning =
app.warningAbout("CAMEL_SPRINGBOOT_MAIN_RUN_CONTROLLER");
+ assertTrue(warning.contains("Use camel.main.run-controller
instead"), warning);
+ assertTrue(app.warnings().stream().noneMatch(m ->
m.contains("LENIENT")),
+ "camel.springboot.lenient-configuration-binding is read: "
+ app.warnings());
+ }
+ }
+
+ @Test
+ public void propertyInSeveralSourcesIsReportedOnce() {
+ try (Started app = start(Map.of(), new String[] {
"--camel.springboot.name=FromArgs" },
+ "camel.springboot.name=Legacy")) {
+ String warning = app.warningAbout("camel.springboot.name");
+ assertTrue(warning.contains("commandLineArgs"), "the source that
wins is named: " + warning);
+ }
+ }
+
+ @Test
+ public void nameIsReportedWithItsReplacement() {
+ try (Started app = start("camel.springboot.name=Legacy")) {
+ assertNotEquals("Legacy", app.camel().getName(),
"camel.springboot.name is not bound");
+ String warning = app.warningAbout("camel.springboot.name");
+ assertTrue(warning.contains("has no effect"), warning);
+ assertTrue(warning.contains("Use camel.main.name instead"),
warning);
+ }
+ }
+
+ @Test
+ public void mainRunControllerIsReportedWithRunController() {
+ try (Started app = start("camel.springboot.main-run-controller=true"))
{
+ String warning =
app.warningAbout("camel.springboot.main-run-controller");
+ assertTrue(warning.contains("Use camel.main.run-controller
instead"), warning);
+ }
+ }
+
+ @Test
+ public void typeConversionIsReportedWithItsReplacement() {
+ try (Started app = start("camel.springboot.type-conversion=false")) {
+ String warning =
app.warningAbout("camel.springboot.type-conversion");
+ assertTrue(warning.contains("Use camel.main.type-conversion
instead"), warning);
+ }
+ }
+
+ @Test
+ public void routeControllerOptionsAreReportedWithTheirReplacement() {
+ try (Started app =
start("camel.springboot.route-controller-supervise-enabled=true",
+ "camel.springboot.route-controller-back-off-delay=1000")) {
+ assertFalse(app.camel().getRouteController().isSupervising(),
+ "camel.springboot.route-controller-supervise-enabled is
not bound");
+ String enabled =
app.warningAbout("camel.springboot.route-controller-supervise-enabled");
+ assertTrue(enabled.contains("Use camel.routecontroller.enabled
instead"), enabled);
+ String delay =
app.warningAbout("camel.springboot.route-controller-back-off-delay");
+ assertTrue(delay.contains("Use
camel.routecontroller.back-off-delay instead"), delay);
+ }
+ }
+
+ @Test
+ public void camelCaseNameIsReportedAsWritten() {
+ try (Started app =
start("camel.springboot.streamCachingEnabled=false")) {
+ assertTrue(app.camel().isStreamCaching(),
"camel.springboot.streamCachingEnabled is not bound");
+ String warning =
app.warningAbout("camel.springboot.streamCachingEnabled");
+ assertTrue(warning.contains("Use camel.main.stream-caching-enabled
instead"), warning);
+ }
+ }
+
+ @Test
+ public void optionWithoutReplacementIsReported() {
+ try (Started app =
start("camel.springboot.xml-routes-reload-directory=src/main/resources/camel"))
{
+ String warning =
app.warningAbout("camel.springboot.xml-routes-reload-directory");
+ assertTrue(warning.contains("has no effect"), warning);
+ assertFalse(warning.contains(" Use "), warning);
+ }
+ }
+
+ @Test
+ public void xmlRoutesAreReportedWithRoutesIncludePattern() {
+ try (Started app =
start("camel.springboot.xml-routes=classpath:camel/*.xml",
+ "camel.springboot.xml-rests=classpath:camel-rest/*.xml",
+
"camel.springboot.xml-route-templates=classpath:camel-template/*.xml")) {
+ for (String option : List.of("xml-routes", "xml-rests",
"xml-route-templates")) {
+ String warning = app.warningAbout("camel.springboot." +
option);
+ assertTrue(warning.contains("Use
camel.main.routes-include-pattern instead"), warning);
+ }
+ }
+ }
+
+ @Test
+ public void supervisingControllerOptionsAreReportedWithTheirReplacement() {
+ try (Started app = start("camel.supervising.controller.enabled=true",
+ "camel.supervising.controller.default-back-off.delay=1000")) {
+ assertFalse(app.camel().getRouteController().isSupervising(),
+ "camel.supervising.controller.enabled is not bound");
+ String enabled =
app.warningAbout("camel.supervising.controller.enabled");
+ assertTrue(enabled.contains("Use camel.routecontroller.enabled
instead"), enabled);
+ String delay =
app.warningAbout("camel.supervising.controller.default-back-off.delay");
+ assertTrue(delay.contains("Use
camel.routecontroller.back-off-delay instead"), delay);
+ }
+ }
+
+ @Test
+ public void renamedDataFormatsAreReportedWithTheirNewName() {
+ try (Started app =
start("camel.dataformat.securexml.key-cipher-algorithm=RSA_OAEP",
+ "camel.dataformat.yaml-snakeyaml.prettyFlow=true")) {
+ String secureXml =
app.warningAbout("camel.dataformat.securexml.key-cipher-algorithm");
+ assertTrue(secureXml.contains("Use
camel.dataformat.xml-security.key-cipher-algorithm instead"), secureXml);
+ String snakeYaml =
app.warningAbout("camel.dataformat.yaml-snakeyaml.prettyFlow");
+ assertTrue(snakeYaml.contains("Use
camel.dataformat.snake-yaml.pretty-flow instead"), snakeYaml);
+ }
+ }
+
+ @Test
+ public void removedHealthOptionsAreReportedWithTheirReplacement() {
+ try (Started app = start("camel.health.components-enabled=true",
"camel.health.config[netty].enabled=false")) {
+ assertFalse(producerHealthChecksEnabled(app),
"camel.health.components-enabled is not bound");
+ String components =
app.warningAbout("camel.health.components-enabled");
+ assertTrue(components.contains("Use camel.health.producers-enabled
instead"), components);
+ String config =
app.warningAbout("camel.health.config[netty].enabled");
+ assertTrue(config.contains("Use camel.health.exclude-pattern
instead"), config);
+ }
+ }
+
+ @Test
+ public void currentOptionsAreAppliedAndNotReported() {
+ try (Started app = start("camel.health.producers-enabled=true",
"camel.dataformat.snake-yaml.pretty-flow=true",
+ "camel.routecontroller.back-off-delay=1000")) {
+ assertTrue(producerHealthChecksEnabled(app));
+ assertTrue(app.warnings().stream().noneMatch(m -> m.contains("has
no effect")),
+ "no WARN about current options: " + app.warnings());
+ }
+ }
+
+ private static boolean producerHealthChecksEnabled(Started app) {
+ HealthCheckRegistry registry
+ =
app.camel().getCamelContextExtension().getContextPlugin(HealthCheckRegistry.class);
+ return
registry.getRepository("producers").map(HealthCheckRepository::isEnabled).orElse(false);
+ }
+
+ @Test
+ public void lenientConfigurationBindingIsNotReported() {
+ try (Started app =
start("camel.springboot.lenient-configuration-binding=true")) {
+ assertTrue(app.warnings().stream().noneMatch(m ->
m.contains("camel.springboot.")),
+ "camel.springboot.lenient-configuration-binding is read: "
+ app.warnings());
+ }
+ }
+
+ @Test
+ public void mainOptionIsAppliedAndNotReported() {
+ try (Started app = start("camel.main.name=Current",
"camel.main.run-controller=false")) {
+ assertEquals("Current", app.camel().getName());
+ assertTrue(app.warnings().stream().noneMatch(m -> m.contains("has
no effect")),
+ "no WARN about camel.main options: " + app.warnings());
+ }
+ }
+
+ /**
+ * The camel.main options that Camel moved to another prefix or replaced,
with the option to use instead.
+ */
+ private static final Map<String, String> MOVED_MAIN_OPTIONS =
movedMainOptions();
+
+ private static Map<String, String> movedMainOptions() {
+ Map<String, String> answer = new HashMap<>();
+ answer.put("camel.main.debugging", "camel.debug.enabled");
+ answer.put("camel.main.debugger", "camel.debug.enabled");
+ answer.put("camel.main.backlog-tracing", "camel.trace.enabled");
+ answer.put("camel.main.backlog-tracing-standby",
"camel.trace.standby");
+ answer.put("camel.main.backlog-tracing-templates",
"camel.trace.trace-templates");
+ answer.put("camel.main.route-controller-supervise-enabled",
"camel.routecontroller.enabled");
+ answer.put("camel.main.route-controller-back-off-delay",
"camel.routecontroller.back-off-delay");
+ answer.put("camel.main.route-controller-include-routes",
"camel.routecontroller.include-routes");
+ answer.put("camel.main.error-registry-enabled",
"camel.errorregistry.enabled");
+ answer.put("camel.main.error-registry-maximum-entries",
"camel.errorregistry.maximum-entries");
+ answer.put("camel.main.error-registry-time-to-live-seconds",
"camel.errorregistry.time-to-live-seconds");
+ answer.put("camel.main.xml-routes",
"camel.main.routes-include-pattern");
+ answer.put("camel.main.xml-rests",
"camel.main.routes-include-pattern");
+ answer.put("camel.main.xml-route-templates",
"camel.main.routes-include-pattern");
+ return Collections.unmodifiableMap(answer);
+ }
+
+ @Test
+ public void movedMainOptionsAreNotBound() {
+ MapConfigurationPropertySource source = new
MapConfigurationPropertySource();
+ MOVED_MAIN_OPTIONS.keySet().forEach(key -> source.put(key, "1000"));
+ source.put("camel.main.name", "Bound");
+ CamelConfigurationProperties.Main main = new
CamelConfigurationProperties().getMain();
+
+ BindException e = assertThrows(BindException.class, () -> new
Binder(source).bind("camel.main",
+ Bindable.ofInstance(main), new
NoUnboundElementsBindHandler(BindHandler.DEFAULT)));
+
+ UnboundConfigurationPropertiesException unbound
+ =
assertInstanceOf(UnboundConfigurationPropertiesException.class, e.getCause());
+ assertEquals(MOVED_MAIN_OPTIONS.keySet(),
unbound.getUnboundProperties().stream()
+ .map(p -> p.getName().toString()).collect(Collectors.toSet()));
+ assertEquals("Bound", main.getName());
+ }
+
+ @Test
+ public void movedMainOptionsAreReportedWithTheirReplacement() {
+ String[] properties = MOVED_MAIN_OPTIONS.keySet().stream().map(key ->
key + "=true").toArray(String[]::new);
+ try (Started app = start(properties)) {
+ assertNotEquals(Boolean.TRUE, app.camel().isBacklogTracing(),
"camel.main.backlog-tracing is not bound");
+ assertNotEquals(Boolean.TRUE, app.camel().isDebugging(),
"camel.main.debugging is not bound");
+ assertFalse(app.camel().getRouteController().isSupervising(),
+ "camel.main.route-controller-supervise-enabled is not
bound");
+ assertFalse(app.camel().getErrorRegistry().isEnabled(),
"camel.main.error-registry-enabled is not bound");
+ for (Map.Entry<String, String> option :
MOVED_MAIN_OPTIONS.entrySet()) {
+ String warning = app.warningAbout(option.getKey());
+ assertTrue(warning.contains("has no effect"), warning);
+ assertTrue(warning.contains("Use " + option.getValue() + "
instead"), warning);
+ }
+ }
+ }
+
+ @Test
+ public void camelCaseMovedMainOptionIsReportedAsWritten() {
+ try (Started app = start("camel.main.backlogTracingStandby=true",
+ "camel.main.routeControllerBackOffDelay=5000")) {
+ String standby =
app.warningAbout("camel.main.backlogTracingStandby");
+ assertTrue(standby.contains("Use camel.trace.standby instead"),
standby);
+ String delay =
app.warningAbout("camel.main.routeControllerBackOffDelay");
+ assertTrue(delay.contains("Use
camel.routecontroller.back-off-delay instead"), delay);
+ }
+ }
+
+ @Test
+ public void springbootOptionMovedFromMainIsReportedWithItsReplacement() {
+ try (Started app = start("camel.springboot.backlog-tracing=true")) {
+ String warning =
app.warningAbout("camel.springboot.backlog-tracing");
+ assertTrue(warning.contains("Use camel.trace.enabled instead"),
warning);
+ }
+ }
+
+ @Test
+ public void unknownMainOptionIsReported() {
+ try (Started app = start("camel.main.nmae=Typo",
"camel.main.error-registry-stack-trace-enabled=true")) {
+ assertNotEquals("Typo", app.camel().getName(), "camel.main.nmae is
not bound");
+ for (String property : List.of("camel.main.nmae",
"camel.main.error-registry-stack-trace-enabled")) {
+ String warning = app.warningAbout(property);
+ assertTrue(warning.endsWith("as Camel on Spring Boot has no
camel.main option of this name."), warning);
+ assertFalse(warning.contains(" Use "), warning);
+ }
+ }
+ }
+
+ @Test
+ public void camelMainStandaloneOptionIsReported() {
+ try (Started app =
start("camel.main.base-package-scan=com.acme.routes",
+ "camel.main.routes-builder-classes=com.acme.routes.MyRoute")) {
+ for (String property : List.of("camel.main.base-package-scan",
"camel.main.routes-builder-classes")) {
+ String warning = app.warningAbout(property);
+ assertTrue(warning.contains("has no effect"), warning);
+ }
+ }
+ }
+
+ @Test
+ public void mainOptionsInEveryFormAreAppliedAndNotReported() {
+ try (Started app = start("camel.main.streamCachingEnabled=false",
"camel.main.shutdown_timeout=7",
+ "camel.main.global-options[CamelLogDebugBodyMaxChars]=500",
"camel.main.global-options.foo=bar",
+ "camel.main.type-conversion=true",
"camel.main.main-run-controller=false",
+ "camel.main.include-non-singletons=false",
"camel.main.warn-on-early-shutdown=true")) {
+ assertFalse(app.camel().isStreamCaching());
+ assertEquals(7, app.camel().getShutdownStrategy().getTimeout());
+ assertEquals("500",
app.camel().getGlobalOptions().get("CamelLogDebugBodyMaxChars"));
+ assertEquals("bar", app.camel().getGlobalOptions().get("foo"));
+ assertTrue(app.warnings().stream().noneMatch(m -> m.contains("has
no effect")),
+ "no WARN about camel.main options: " + app.warnings());
+ }
+ }
+
+ @Test
+ public void mainEnvironmentVariablesAreReportedOnlyWhenMoved() {
+ try (Started app = start(Map.of("CAMEL_MAIN_SHUTDOWN_TIMEOUT", "5",
"CAMEL_MAIN_BACKLOG_TRACING", "true",
+ "CAMEL_MAIN_NMAE", "Typo"), new String[0])) {
+ assertEquals(5, app.camel().getShutdownStrategy().getTimeout());
+ String warning = app.warningAbout("CAMEL_MAIN_BACKLOG_TRACING");
+ assertTrue(warning.contains("Use camel.trace.enabled instead"),
warning);
+ // the name of an environment variable cannot tell a dash from a
dot, so a typo is not reported
+ assertEquals(List.of(warning), app.warnings().stream().filter(m ->
m.contains("has no effect")).toList());
+ }
+ }
+
+ @Test
+ public void everyDocumentedMainOptionIsNotReported() throws IOException {
+ Map<String, Object> properties = new HashMap<>();
+ documentedMainOptions().forEach(option -> properties.put(option, "x"));
+ assertTrue(properties.size() > 100, "the camel.main options of the
metadata: " + properties.keySet());
+ properties.put("camel.main.type-conversion", "x");
+ properties.put("camel.main.global-options.foo", "x");
+ StandardEnvironment environment = new StandardEnvironment();
+ environment.getPropertySources().addFirst(new
MapPropertySource("test", properties));
+
+ ListAppender<ILoggingEvent> appender = new ListAppender<>();
+ appender.start();
+ rootLogger().addAppender(appender);
+ try {
+ CamelAutoConfiguration.warnUnboundMainProperties(environment);
+ } finally {
+ rootLogger().detachAppender(appender);
+ appender.stop();
+ }
+ assertEquals(List.of(),
appender.list.stream().map(ILoggingEvent::getFormattedMessage).toList());
+ }
+
+ /**
+ * The camel.main options in the Spring Boot configuration metadata of
this module.
+ */
+ @SuppressWarnings("unchecked")
+ private static Set<String> documentedMainOptions() throws IOException {
+ List<URL> urls =
Collections.list(RemovedPropertiesWarningTest.class.getClassLoader()
+ .getResources("META-INF/spring-configuration-metadata.json"));
+ List<String> answer = new ArrayList<>();
+ for (URL url : urls) {
+ try (InputStream is = url.openStream()) {
+ Map<String, Object> metadata =
JsonParserFactory.getJsonParser()
+ .parseMap(new String(is.readAllBytes(),
StandardCharsets.UTF_8));
+ for (Object property : (List<Object>)
metadata.getOrDefault("properties", List.of())) {
+ String name = (String) ((Map<String, Object>)
property).get("name");
+ if (name.startsWith("camel.main.")) {
+ answer.add(name);
+ }
+ }
+ }
+ }
+ return Set.copyOf(answer);
+ }
+}
diff --git
a/docs/spring-boot/modules/ROOT/pages/starters/undertow-spring-security.adoc
b/docs/spring-boot/modules/ROOT/pages/starters/undertow-spring-security.adoc
index 0303c75c2e3..3e7fd5ecfe5 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/undertow-spring-security.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/undertow-spring-security.adoc
@@ -42,7 +42,7 @@ The starter supports 6 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| camel.security.undertow.keycloak | Properties defined for keycloak provider.
Value is gathered together from properties with prefix
"camel.component.undertow.spring.security.keycloak" | |
KeycloakProviderConfiguration
+| camel.security.undertow.keycloak | Properties defined for keycloak provider.
Value is gathered together from properties with prefix
"camel.security.undertow.keycloak" | | KeycloakProviderConfiguration
| camel.security.undertow.keycloak.client-id | Client id from the Keycloak
server used for authentication. | | String
| camel.security.undertow.keycloak.realm-id | Realm id from the keycloak
server used for authentication. | | String
| camel.security.undertow.keycloak.url | Url to keycloak server which will be
used in spring security configuration. (Example "http://localhost:8080") | |
String