views:

208

answers:

1

Ok I'm having a problem with SEAM (2.1.1.GA) that doesn't make any sense to me.

I have a component which is session scoped and annotated with @AutoCreate.

The component has a creation method annotated with @Create.

The problem is that BEFORE THE CREATE METHOD COMPLETES seam is calling another method on the same component instance. Because the creation method hasn't completed this 2nd method is throwing errors.

Is this expected behavior? Surely the other calls to the component should block until create is finished executing?!

Does anyone know anything about this... I'm kind of at my wit's end. At this point I'm just trying to work around the problem but it seems that this shouldn't even be a problem in the first place.

A: 

What is calling the 2nd method?

If it is another Bean that is also being auto-created at startup, then put your first bean in as a dependency.

@AutoCreate
@Startup(depends={"firstBean"})
@Name("secondBean")
public class SecondBean() {
...
}
Damo