routeExcludingContext = new GenericApplicationContext();
routeExcludingContext.registerBeanDefinition("excludingResolver", new RootBeanDefinition(ExcludingPackageScanClassResolver.class));
routeExcludingContext.refresh();
ExcludingPackageScanClassResolver excludingResolver = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class);
List<Class<?>> excluded = Arrays.asList(excludedClasses);
excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded));
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Not enabling package scanning excluded classes as ExcludeRoutes "
+ "annotation was found but no classes were excluded.");
}