On Friday, July 10, 2015 at 12:04:20 PM UTC+2, Naresh Janarthanam wrote:
>
> web.xml configuration for servlets can also be removed 
> using javax.servlet.annotation.WebServlet. Any thoughts, if other Guice 
> servlet module functionalities like Scopes and filter will be supported by 
> standard Java.
>

Filters can similarly be declared with javax.servlet.annotation.WebFilter, 
and "standard Java" (JavaEE) has "resource injection" (used with JNDI), and 
CDI as a total replacement of Guice, with ApplicationScoped, SessionScoped, 
ConversationScoped, TransactionScoped, and RequestScoped.
If you want to use Guice, then you *have* to use Guice's ServletModule 
though, or your servlets and filters won't be injected (unless you inject 
them yourself, e.g. in their init(), retrieving the Injector out of the 
ServletContext). I think the *goal* of Guice Servlets is not to "remove the 
servlet configuration from the web.xml", this is merely a side-effect of 
the constraint that Guice must instantiate them as there's no standard 
listener where it could hook to do the injection, and as a further 
side-effect that also allows registering servlet and filters using regexps 
instead of URL patterns.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/11f2469d-85f8-4206-9491-e498a6b3e165%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to