Repository: camel Updated Branches: refs/heads/master 246c45043 -> 9338801e1
CAMEL-10197: Fixing boxing and blacklisted recursive properties Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9338801e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9338801e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9338801e Branch: refs/heads/master Commit: 9338801e1f72ebf2c15a5de5a6da5b367bd2e492 Parents: 246c450 Author: Nicola Ferraro <[email protected]> Authored: Wed Sep 21 10:42:39 2016 +0200 Committer: Nicola Ferraro <[email protected]> Committed: Wed Sep 21 10:47:40 2016 +0200 ---------------------------------------------------------------------- .../springboot/AMQPComponentConfiguration.java | 1 - .../DirectComponentConfiguration.java | 2 +- .../DirectVmComponentConfiguration.java | 2 +- .../FreemarkerComponentConfiguration.java | 2 -- .../springboot/JmsComponentConfiguration.java | 1 - .../springboot/EventComponentConfiguration.java | 2 -- .../camel-spring-boot-generator-bom/pom.xml | 1 + .../SpringBootAutoConfigurationMojo.java | 20 ++++++++++++++++---- 8 files changed, 19 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java index 4a6b737..114bcc8 100644 --- a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java +++ b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java @@ -522,7 +522,6 @@ public class AMQPComponentConfiguration { /** * Sets the Spring ApplicationContext to use */ - @NestedConfigurationProperty private ApplicationContext applicationContext; /** * To use a custom QueueBrowseStrategy when browsing queues http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java index 5774bac..0b99319 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java @@ -36,7 +36,7 @@ public class DirectComponentConfiguration { /** * The timeout value to use if block is enabled. */ - private Long timeout = 30000; + private Long timeout = 30000L; public Boolean getBlock() { return block; http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java index c6c9b80..6ba1c4f 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java @@ -38,7 +38,7 @@ public class DirectVmComponentConfiguration { /** * The timeout value to use if block is enabled. */ - private Long timeout = 30000; + private Long timeout = 30000L; /** * Sets a HeaderFilterStrategy that will only be applied on producer * endpoints (on both directions: request and response). Default value: http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java index 5b08f2d..a03cf42 100644 --- a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java +++ b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java @@ -18,7 +18,6 @@ package org.apache.camel.component.freemarker.springboot; import freemarker.template.Configuration; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * Transforms the message using a FreeMarker template. @@ -32,7 +31,6 @@ public class FreemarkerComponentConfiguration { * To use an existing freemarker.template.Configuration instance as the * configuration. */ - @NestedConfigurationProperty private Configuration configuration; public Configuration getConfiguration() { http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java b/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java index 5bddc33..5f439ae 100644 --- a/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java +++ b/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java @@ -526,7 +526,6 @@ public class JmsComponentConfiguration { /** * Sets the Spring ApplicationContext to use */ - @NestedConfigurationProperty private ApplicationContext applicationContext; /** * To use a custom QueueBrowseStrategy when browsing queues http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java index 63f9847..a2cc856 100644 --- a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java +++ b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java @@ -17,7 +17,6 @@ package org.apache.camel.component.event.springboot; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.context.ApplicationContext; /** @@ -31,7 +30,6 @@ public class EventComponentConfiguration { /** * The Spring ApplicationContext */ - @NestedConfigurationProperty private ApplicationContext applicationContext; public ApplicationContext getApplicationContext() { http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/spring-boot-dm/camel-spring-boot-generator-bom/pom.xml ---------------------------------------------------------------------- diff --git a/spring-boot-dm/camel-spring-boot-generator-bom/pom.xml b/spring-boot-dm/camel-spring-boot-generator-bom/pom.xml index a203867..d71a297 100644 --- a/spring-boot-dm/camel-spring-boot-generator-bom/pom.xml +++ b/spring-boot-dm/camel-spring-boot-generator-bom/pom.xml @@ -256,6 +256,7 @@ <!-- Different versions required by some modules --> <exclude>com.google.inject:*</exclude> <exclude>com.google.guava:*</exclude> + <exclude>io.netty*:*</exclude> <exclude>org.scala-lang:*</exclude> <exclude>org.apache.lucene:*</exclude> http://git-wip-us.apache.org/repos/asf/camel/blob/9338801e/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java index 7d0e89c..02bec80 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java @@ -98,7 +98,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { /** * Classes to exclude when adding {@link NestedConfigurationProperty} annotations. */ - private static final Pattern EXCLUDE_INNER_PATTERN = Pattern.compile("^((java\\.)|(javax\\.)).*"); + private static final Pattern EXCLUDE_INNER_PATTERN = Pattern.compile("^((java\\.)|(javax\\.)|(org\\.springframework\\.context\\.ApplicationContext)|(freemarker\\.template\\.Configuration)).*"); private static final Map<String, String> PRIMITIVEMAP; @@ -357,7 +357,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { if ("java.lang.String".equals(option.getJavaType())) { prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { - prop.getField().setLiteralInitializer(option.getDefaultValue()); + String value = option.getDefaultValue(); + if("long".equals(option.getJavaType()) && !value.toUpperCase().endsWith("L")) { + value = value + "L"; + } + prop.getField().setLiteralInitializer(value); } else if (!Strings.isBlank(option.getEnumValues())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); @@ -636,7 +640,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { if ("java.lang.String".equals(option.getType())) { prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { - prop.getField().setLiteralInitializer(option.getDefaultValue()); + String value = option.getDefaultValue(); + if("long".equals(option.getJavaType()) && !value.toUpperCase().endsWith("L")) { + value = value + "L"; + } + prop.getField().setLiteralInitializer(value); } else if (!Strings.isBlank(option.getEnumValues())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); @@ -724,7 +732,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { if ("java.lang.String".equals(option.getType())) { prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { - prop.getField().setLiteralInitializer(option.getDefaultValue()); + String value = option.getDefaultValue(); + if("long".equals(option.getJavaType()) && !value.toUpperCase().endsWith("L")) { + value = value + "L"; + } + prop.getField().setLiteralInitializer(value); } else if (!Strings.isBlank(option.getEnumValues())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue());
