}
Object reference = beanManager.getReference(bean, beanClass, createContext);
ObjectHelper.notNull(reference, "Could not instantiate bean of type " + beanClass.getName() + " for " + bean);
try {
if (reference instanceof RoutesBuilder) {
RoutesBuilder routeBuilder = (RoutesBuilder)reference;
camelContext.addRoutes(routeBuilder);
} else if (reference instanceof RouteContainer) {
RouteContainer routeContainer = (RouteContainer)reference;
camelContext.addRouteDefinitions(routeContainer.getRoutes());
} else {