Questions tagged [guice-servlet]

Guice's servlet extensions allow you to completely eliminate web.xml from your servlet application and take advantage of type-safe, idiomatic Java configuration of your servlet and filter components

Guice Servlet Extensions

Guice Servlet provides a complete story for use in web applications and servlet containers. Guice's servlet extensions allow you to completely eliminate web.xml from your servlet application and take advantage of type-safe, idiomatic Java configuration of your servlet and filter components.

This has advantages not only in being able to use a nicer API for configuring your web applications, but also in tying together dependency injection with web components. Meaning that your servlets and filters benefit from:

  • Constructor injection
  • Type-safe, idiomatic configuration
  • Modularization (package and distribute custom Guice Servlet libraries)
  • Guice AOP

While keeping the benefits of the standard servlet lifecycle.

References

99 questions
29
votes
8 answers

How to use guice-servlet with Jersey 2.0?

Is there any sample code demonstrating how to use guice-servlet with Jersey 2.0?
Gili
  • 76,473
  • 85
  • 341
  • 624
12
votes
3 answers

Guice + Tomcat potential memory leak

I have just started using Google Guice with my Tomcat webapp, and have noticed the following in the catalina.out file whenever the WAR file is undeployed: May 16, 2011 5:37:24 PM org.apache.catalina.startup.HostConfig checkResources INFO:…
Peter Sankauskas
  • 2,612
  • 3
  • 24
  • 27
10
votes
4 answers

NoClassDefFoundError in web application running on Tomcat 7

I have web application written in Java using gucie-servlet framework being built by Maven 3. When I deploy it on Tomcat 7 container and try to access it using browser, Tomcat replies with 404 status code. This is log from Tomcat: Apr 4, 2013…
Fyodor Sherstobitov
  • 595
  • 1
  • 4
  • 17
8
votes
1 answer

Configuring Apache Shiro with Google Guice Servlet

I'm starting to use Guice/Shiro instead of Spring/Spring Security. I have looked examples from Shiro site, and all configuration examples are made as INI-file examples. Is it possible to configure Shiro in plain Java, as Guice Servlets are meant to…
newbie
  • 22,918
  • 75
  • 190
  • 297
8
votes
1 answer

How to get Google Guice working with JaxRS (Jersey)

I have a basic JAXRS service that I can expose easily, but for once I wish to use a dependency injection API and I suspect Google Guice will be one of the best. With this in mind, I have tried to integrate it, but the documentation is a little…
Devology Ltd
  • 1,127
  • 1
  • 13
  • 32
7
votes
2 answers

Weblogic 12c : Prefer-web-inf-classes and prefer-application-packages for Jersey

I have to use both (oddly enough ..) prefer-web-inf-classes and prefer-application-packages properties of weblogic.xml on a Weblogic 12c Server (12.2.1) It is REST application based on Jersey 1.9. ( Jersey 1.x JAX-RS RI) and Guice. 1. Why use…
Azimuts
  • 1,102
  • 3
  • 14
  • 33
6
votes
2 answers

Injecting dependencies to ServletContextListener with Guice

Since ServletContextListener is created by the server, not by Guice I can't find a way to make it work together. How do I get guice injector at ServletContextListener? Maybe there is better way to shutdown services like logger or persistance then…
6
votes
1 answer

Tomcat: using servlet and websocket (jsr356) in same web app

I create a sample webapp using Guice-servlets and websocket in tomcat, now once guice filter is used websocket stop working Basic information: In my web.xml, i initialized the Guiceservlet using GuiceBasedListener
Bhuvan
  • 3,509
  • 5
  • 26
  • 70
6
votes
1 answer

Servlet 3.0 annotations in conjuction with Guice

I am attempting to update a legacy Guice application, and I was wondering if there is any sort of preferred way of doing things when taking Servlet 3.0 annotations into consideration. For example, my application has a filter, FooFilter, which is…
oberger
  • 1,197
  • 2
  • 14
  • 29
6
votes
1 answer

Use Guice Injection in a Java GAE Backend Servlet

I have a dilemma in my GAE Java app: I am trying to write a servlet that will be handled by GAE backends and it must also use Guice dependency injection to initiate all the servlet's fields. I have tried multiple approaches but none seems to be…
ecbrodie
  • 9,397
  • 19
  • 62
  • 109
5
votes
0 answers

How to specify the dispatcher type for a filter defined in a Guice Servlet Module?

I'm working on a Java based web app. We're using Guice and its ServletModule to configure servlets and filters. Now, I need a Filter to be invoked even when a request is forwarded through the dispatcher, not only on incoming requests. In a plain JEE…
danidemi
  • 3,354
  • 3
  • 30
  • 37
5
votes
0 answers

Integrating Guice with Jersey (squarespace): No ServiceLocatorGenerator installed

I am deploying a Jersey 2.22 application which I am trying to integrate smoothly with Guice 4.0 using the Squarespace jersey2-guice-impl library so that I can easily inject Guice dependencies into my controllers. (My apologies for minor typos below…
MeowCode
  • 961
  • 2
  • 10
  • 29
5
votes
1 answer

Guice Provider vs EntityManager

I was trying to get simple webapp working with Guice and JPA on Jetty, using the persistence and servlet guice extensions. I have written this Service implementation class: public class PersonServiceImpl implements PersonService { private…
Bennyz
  • 603
  • 2
  • 17
  • 36
5
votes
1 answer

Guice : How to bind classes that are dynamically obtained by an already binded object?

I'm developing a small web framework using Guice. I have a Router object that, once initialized, expose a getControllerClasses() method. I have to loop over all those dynamically returned classes to bind() them using Guice. I bind the Router…
electrotype
  • 7,090
  • 11
  • 49
  • 89
5
votes
1 answer

Guice : Is it possible to get all binded instances given a particular parent/interface/annotation?

I know this may not be dependency injection in its purest form, but let's say I have to use : @Inject Injector injector; With this injector, is it possible to get all the binded instances given : A parent class each instances would inherited…
electrotype
  • 7,090
  • 11
  • 49
  • 89
1
2 3 4 5 6 7