I am new to Google Guice and I have a question regarding injecting into a guice servlet and using RequestScope. Ok, let me give an example from my code to make things clear.
I have a bean class like bean ..
@RequestScope public class Bean { private String user; private String pass;
Here i have a servlet
@Singleton public class MainServlet extends HttpServlet { doGet(HttpServletRequest request, HttpServletResponse response) { .... some code Injector injector = Guice.createInjector(); ValidUser validUser = injector.getInstance(ValidUser.class)
Interestingly, the servlet area is single, as we know. And also, how can I get a bean instance from an http request? because, as I understand it, after entering an instance of the bean class, it goes into an HTTP request, right?
Any help or example is appreciated. thanks br
brakebg
source share