camel git commit: CAMEL-10799: camel-connector allow to configure sb config prefix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

camel git commit: CAMEL-10799: camel-connector allow to configure sb config prefix

davsclaus-2
Repository: camel
Updated Branches:
  refs/heads/master f9e05f740 -> a7e9acda4


CAMEL-10799: camel-connector allow to configure sb config prefix


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a7e9acda
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7e9acda
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7e9acda

Branch: refs/heads/master
Commit: a7e9acda41ee6a2a9acad7162ce8d94d210c7ab0
Parents: f9e05f7
Author: Claus Ibsen <[hidden email]>
Authored: Thu Mar 16 15:23:49 2017 +0100
Committer: Claus Ibsen <[hidden email]>
Committed: Thu Mar 16 15:29:13 2017 +0100

----------------------------------------------------------------------
 .../connector/SpringBootAutoConfigurationMojo.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a7e9acda/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
index d2c65f1..ba4ddbb 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
@@ -72,6 +72,9 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
     @Parameter(defaultValue = "true")
     private boolean includeLicenseHeader;
 
+    @Parameter(defaultValue = "camel.connector")
+    private String configurationPrefix;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
@@ -180,9 +183,17 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         doc = doc.replaceAll("component", "connector");
         javaClass.getJavaDoc().setFullText(doc);
 
-        String prefix = "camel.connector." + model.getScheme();
-        // make sure prefix is in lower case
-        prefix = "camel.connector." + connectorScheme.toLowerCase(Locale.US);
+        // compute the configuration prefix to use with spring boot configuration
+        String prefix = "";
+        if (!"false".equalsIgnoreCase(configurationPrefix)) {
+            // make sure prefix is in lower case
+            prefix = configurationPrefix.toLowerCase(Locale.US);
+            if (!prefix.endsWith(".")) {
+                prefix += ".";
+            }
+        }
+        prefix += connectorScheme.toLowerCase(Locale.US);
+
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
 
         for (ComponentOptionModel option : model.getComponentOptions()) {

Loading...