bzdgn opened a new issue #2341:
URL: https://github.com/apache/camel-k/issues/2341


   I've applied the camel [rest dsl example 
here](https://camel.apache.org/manual/latest/rest-dsl.html#_rest_dsl_with_java) 
for the Camel K, the simple integration file is as follows, which fails;
   
   ```java
   import org.apache.camel.builder.RouteBuilder;
   
   public class RestRoute extends RouteBuilder {
   
       @Override
       public void configure() throws Exception {
           
           // rest endpoints
           rest("/status")
               .get("/hello").to("direct:hello");
           
           // routes
           from("direct:hello")
               .transform().constant("Hello World");
           
       }
   
   }
   ```
   
   However, if I add ```marshal().json()``` line to the route, it works;
   
   ```java
   import org.apache.camel.builder.RouteBuilder;
   
   public class RestRoute extends RouteBuilder {
   
       @Override
       public void configure() throws Exception {
           
           // rest endpoints
           rest("/status")
               .get("/hello").to("direct:hello");
           
           // routes
           from("direct:hello")
               .transform().constant("Hello World")
               .marshal().json();
           
       }
   
   }
   ```
   
   And even if I comment out the ```marshal().json()``` line, it continues to 
work;
   
   ```java
   import org.apache.camel.builder.RouteBuilder;
   
   public class RestRoute extends RouteBuilder {
   
       @Override
       public void configure() throws Exception {
           
           // rest endpoints
           rest("/status")
               .get("/hello").to("direct:hello");
           
           // routes
           from("direct:hello")
               .transform().constant("Hello World")
               .marshal().json();
           
       }
   
   }
   ```
   
   Is there a problem with this example, or the code I've shared, or is this a 
bug?
   
   I've also asked this on stackoverflow but I suspect that it may be a bug;
   
   
https://stackoverflow.com/questions/67731034/camel-k-rest-route-needs-json-marshalling-and-commented-code-executed


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to