boolean loaded = false;
ExecutionContext origContext
= ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
try {
for (String s : container.getComponentIds()) {
Recipe r = container.getRepository().getRecipe(s);
if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
&& type.isAssignableFrom(((BeanRecipe)r).getType())) {
names.add(s);
}
}
Collections.reverse(names);
for (String s : names) {
BeanRecipe r = (BeanRecipe)container.getRepository().getRecipe(s);
Class<?> beanType = r.getType();
Class<? extends T> t = beanType.asSubclass(type);
if (listener.loadBean(s, t)) {
Object o = container.getComponentInstance(s);
if (listener.beanLoaded(s, type.cast(o))) {
return true;