Hi, I bumped with this while creating an extension. I've noticed that on my extension if I try to do a simple toString on my beanReference I get an error about the scope not being ready.
This happens here:
void afterDeploymentValidation(@Observes AfterDeploymentValidation add, final BeanManager beanManager){
Set<Bean<?>> beans = beanManager.getBeans(CDICamelContext.class);
CamelContext context = null;
for(Bean b : beans){
context = (CamelContext) beanManager.getReference(b, CamelContext.class, beanManager.createCreationalContext(b));
}
if(context != null){
try {
logger.debug("starting camel context");
context.setPackageScanClassResolver(new JBossPackageScanClassResolver());
context.start();
createConsumers(context, beanManager);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}On the createConsumers code, if I try to get a bean from beanmanager and access its toString() I get the exception. It's really strange that the WeldProxy when invoking the toString of the class actually looks for a context. Shouldn't those base methods be excluded on the invoke process?
I'm just wondering if this is a possible bug or not.
Regards