vilmosnagy commented on pull request #4998:
URL: https://github.com/apache/camel/pull/4998#issuecomment-776084277


   I think this PR broke our old-style way config.
   
   We had multiple XML files, and each file contained one, and exactly one 
route, and used the following spring boot config:
   
   ```xml
   camel:
     springboot:
       main-run-controller: true
       xml-routes: classpath:camel/**/*.xml
   ```
   
   Now I had to write the following Java code to do the same:
   
   ```java
               private void loadRoutesInOldStyleCamelWay(CamelContext 
camelContext) {
                   try {
                       final Resource[] resources = new 
PathMatchingResourcePatternResolver().getResources("classpath:camel/**/*.xml");
                       for(Resource resource: resources) {
                           
camelContext.adapt(ExtendedCamelContext.class).getRoutesLoader().loadRoutes(
                               new org.apache.camel.spi.Resource() {
                                   @Override
                                   public String getLocation() {
                                       return resource.getFilename();
                                   }
   
                                   @Override
                                   public InputStream getInputStream() throws 
IOException {
                                       return resource.getInputStream();
                                   }
                               }
                           );
                       }
                   } catch (Exception e) {
                       throw new RuntimeException(e);
                   }
               }
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to