Skip to content

Commit

Permalink
CAMEL-19933: camel-jbang - Register bean model when loading XML osgi …
Browse files Browse the repository at this point in the history
…beans, also when ignore loading error.
  • Loading branch information
davsclaus committed Sep 29, 2023
1 parent 96381e5 commit f2e3577
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ protected void configureRoutesLoader(CamelContext camelContext) {
} else {
routesLoader = new DependencyDownloaderRoutesLoader(camelContext);
}
routesLoader.setIgnoreLoadingError(this.mainConfigurationProperties.isRoutesCollectorIgnoreLoadingError());

// use resolvers that can auto downloaded
camelContext.getCamelContextExtension()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.camel.spi.Resource;
import org.apache.camel.spi.ResourceLoader;
import org.apache.camel.support.ObjectHelper;
import org.apache.camel.support.PluginHelper;
import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.KeyValueHolder;
import org.apache.camel.util.StringHelper;
Expand Down Expand Up @@ -258,6 +259,11 @@ private void registerBeanDefinition(CamelContext camelContext, RegistryBeanDefin
if (delayIfFailed) {
delayedRegistrations.add(def);
} else {
boolean ignore = PluginHelper.getRoutesLoader(camelContext).isIgnoreLoadingError();
if (ignore) {
// still add bean if we are ignore loading as we want to know about all beans if possible
addBeanToCamelModel(camelContext, name, def);
}
LOG.warn("Error creating bean: {} due to: {}. This exception is ignored.", type, e.getMessage(), e);
}
}
Expand Down

0 comments on commit f2e3577

Please sign in to comment.