O'Reilly logo

Java 9 Programming By Example by Peter Verhas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dependency injection with Guice

The servlet class is very simple as shown in the following:

package packt.java9.by.example.mastermind.servlet; import com.google.inject.Guice; import com.google.inject.Injector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class Mastermind extends HttpServlet {     private static final Logger log = LoggerFactory.getLogger(Mastermind.class);     public void doGet(HttpServletRequest request,                       HttpServletResponse response)             throws ServletException, IOException {         doPost(request, response);     }  public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required