Pregunta

I have a @SessionScoped CDI bean which is nicely storing information per user session. However I would like to use the same bean but have a new instance of it in say a request scope but once it gets created it remains in the session for that request. So for another request I want it to create a new bean.

Is this possible using CDI?

¿Fue útil?

Solución

You'd need a new @RequestScoped bean that creates your existing bean class via the normal new operator (i.e. not injected). You can't simultaneously treat a single bean obtained by the container as request and session scoped.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top