当前位置: 动力学知识库 > 问答 > 编程问答 >

cdi - what scope of a bean before conversation.begin method is called

问题描述:

I have a CDI bean:

@Named

@ConversationScoped

public class MyBean implements Serializable{

@Inject

private Conversation converstion;

private void conversationBegin() {

converstion.begin();

}

}

My question is:

what scope of this bean before conversationBegin() is called?

网友答案:

I think you're thinking about CDI wrong.

You hold a contextual reference to a bean with type MyBean. When you use it, a contextual instance is either created or obtained from the active conversation context and proxied by your contextual reference.

There is no change of scope. The only thing that changes over time is which context is active and whether there are instances already in the context or not.

分享给朋友:
您可能感兴趣的文章:
随机阅读: