Skip to content
Advertisement

@RequestScoped + new thread

We use javaEE RequestScoped with OpenLiberty and new threads via EJB @Asynchronous. I am just curious what the actual value comes from when we inject RequestScoped bean inside a new thread? Will the RequestScoped bean be freshly initialized? Or will it be pulled from the latest request?

Answer

In OpenLiberty, you’ll get a new request scope every time you make an EJB @Asynchronous call, meaning that you’ll get a new freshly initialized instance of any injected RequestScoped beans while you’re within that method call.

Advertisement