Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.2
-
None
-
None
Description
If a bean A is within conversation A, and a method on the bean does:
Conversation.getCurrentInstance().invalidate();
Object o2 = frameworkAdapter.getBean("A");
assert(o1 != this);
The above will fail; the bean is the same one.
The issue is that the invalidate() actually does nothing because the conversation is currently active; we actually delete the conversation after the method returns. And therefore the getBean() call still returns the same object instance.
Why is invalidation delayed (ie the Conversation detached from the scope) until the conversation is inactive?
It would be nice if an error was returned in this case; it doesn't seem useful to return beans from a conversation after the conversation has been invalidated. Or alternately, unlink the conversation from the SpringConversationScope so that a new conversation instance will be created immediately, even if it isn't invalidated, so that we get new instances of the beans returned.