You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/06/11 07:27:04 UTC
[camel] 03/04: CAMEL-13627: camel-main - Reuse options for main and
camel-spring-boot
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1e282961bd4c010969d15b097d6b8b2cc572a1b6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 11 08:59:05 2019 +0200
CAMEL-13627: camel-main - Reuse options for main and camel-spring-boot
---
.../spring/boot/CamelConfigurationProperties.java | 8 -------
.../camel/main/DefaultConfigurationProperties.java | 28 ++++++++++++++++++++++
.../java/org/apache/camel/main/MainSupport.java | 1 +
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index 4e82791..2a06a51 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
@@ -426,14 +426,6 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
this.warnOnEarlyShutdown = warnOnEarlyShutdown;
}
- public boolean isLoadTypeConverters() {
- return loadTypeConverters;
- }
-
- public void setLoadTypeConverters(boolean loadTypeConverters) {
- this.loadTypeConverters = loadTypeConverters;
- }
-
public String getJavaRoutesIncludePattern() {
return javaRoutesIncludePattern;
}
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
index f8c3420..800fad9 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java
@@ -37,6 +37,7 @@ public abstract class DefaultConfigurationProperties<T> {
private boolean jmxEnabled = true;
private int producerTemplateCacheSize = 1000;
private int consumerTemplateCacheSize = 1000;
+ private boolean loadTypeConverters = true;
private int logDebugMaxChars;
private boolean streamCachingEnabled;
private String streamCachingSpoolDirectory;
@@ -231,6 +232,21 @@ public abstract class DefaultConfigurationProperties<T> {
this.consumerTemplateCacheSize = consumerTemplateCacheSize;
}
+ public boolean isLoadTypeConverters() {
+ return loadTypeConverters;
+ }
+
+ /**
+ * Whether to load custom type converters by scanning classpath.
+ * This is used for backwards compatibility with Camel 2.x.
+ * Its recommended to migrate to use fast type converter loading
+ * by setting <tt>@Converter(loader = true)</tt> on your custom
+ * type converter classes.
+ */
+ public void setLoadTypeConverters(boolean loadTypeConverters) {
+ this.loadTypeConverters = loadTypeConverters;
+ }
+
public int getLogDebugMaxChars() {
return logDebugMaxChars;
}
@@ -754,6 +770,18 @@ public abstract class DefaultConfigurationProperties<T> {
}
/**
+ * Whether to load custom type converters by scanning classpath.
+ * This is used for backwards compatibility with Camel 2.x.
+ * Its recommended to migrate to use fast type converter loading
+ * by setting <tt>@Converter(loader = true)</tt> on your custom
+ * type converter classes.
+ */
+ public T withLoadTypeConverters(boolean loadTypeConverters) {
+ this.loadTypeConverters = loadTypeConverters;
+ return (T) this;
+ }
+
+ /**
* Is used to limit the maximum length of the logging Camel message bodies. If the message body
* is longer than the limit, the log message is clipped. Use -1 to have unlimited length.
* Use for example 1000 to log at most 1000 characters.
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index d4d69aa..f3dfaf5 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -877,6 +877,7 @@ public abstract class MainSupport extends ServiceSupport {
camelContext.setUseBreadcrumb(config.isUseBreadcrumb());
camelContext.setUseDataType(config.isUseDataType());
camelContext.setUseMDCLogging(config.isUseMdcLogging());
+ camelContext.setLoadTypeConverters(config.isLoadTypeConverters());
if (camelContext.getManagementStrategy().getManagementAgent() != null) {
camelContext.getManagementStrategy().getManagementAgent().setEndpointRuntimeStatisticsEnabled(config.isEndpointRuntimeStatisticsEnabled());