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 2021/06/06 05:20:30 UTC

[camel] branch master updated: Allow customizing SpringBoot @RequestMapping paths (#5625)

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


The following commit(s) were added to refs/heads/master by this push:
     new 3f948a1  Allow customizing SpringBoot @RequestMapping paths (#5625)
3f948a1 is described below

commit 3f948a104139d6823747cde070e139e4a30140c7
Author: Marcelo Daniel Silva Sales <ma...@gmail.com>
AuthorDate: Sun Jun 6 07:20:04 2021 +0200

    Allow customizing SpringBoot @RequestMapping paths (#5625)
    
    Instead of configuring RequestMapping with "/**" this change allows inserting custom paths. Usually the "/**" conflicts with /actuator/hawtio. On the other hand, there may be paths that we don't want to be handled by the Controller. ** This change depends on the acceptance of the change in class https://github.com/apache/camel/blob/main/tooling/openapi-rest-dsl-generator/src/main/java/org/apache/camel/generator/openapi /SpringBootProjectSourceCodeGenerator.java from the openapi-rest-d [...]
---
 .../org/apache/camel/maven/generator/openapi/GenerateMojo.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/GenerateMojo.java b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/GenerateMojo.java
index b4e598d..dd7da56 100644
--- a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/GenerateMojo.java
+++ b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/GenerateMojo.java
@@ -48,6 +48,9 @@ public class GenerateMojo extends AbstractGenerateMojo {
     @Parameter
     private String packageName;
 
+    @Parameter(defaultValue = "/**", required = true)
+    private String[] requestMappingValues;
+
     @Override
     public void execute() throws MojoExecutionException {
         if (skip) {
@@ -70,10 +73,6 @@ public class GenerateMojo extends AbstractGenerateMojo {
 
         final RestDslSourceCodeGenerator<Path> generator = RestDslGenerator.toPath(openapi);
 
-        if (ObjectHelper.isNotEmpty(basePath)) {
-            generator.withBasePath(basePath);
-        }
-
         if (ObjectHelper.isNotEmpty(filterOperation)) {
             generator.withOperationFilter(filterOperation);
         }
@@ -121,7 +120,8 @@ public class GenerateMojo extends AbstractGenerateMojo {
                     }
                     getLog().info("Generating Camel Rest Controller source with package name " + packageName
                                   + " in source directory: " + outputPath);
-                    SpringBootProjectSourceCodeGenerator.generator().withPackageName(packageName).generate(outputPath);
+                    SpringBootProjectSourceCodeGenerator.generator().withPackageName(packageName)
+                            .withMappingValues(requestMappingValues).generate(outputPath);
                     // the Camel Rest Controller allows to use root as context-path
                     generator.withRestContextPath("/");
                 } catch (final IOException e) {