Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.tectonica.guice;
 
Servlet-listener for setting Guice as the dependency-injection engine for JSF ManagedBeans. Intended to be used with GuiceJsfInjector.

To use it, first make sure to include the following dependency in your pom.xml:

 <dependency>
    <groupId>com.google.inject.extensions</groupId>
    <artifactId>guice-servlet</artifactId>
 </dependency>
 
Then, if no extra-bindings are needed, you can simply register the listener with web.xml:
 <listener>
    <listener-class>com.tectonica.guice.GuiceJsfListener</listener-class>
 </listener>
 
If you need additional bindings, please extend GuiceListener by providing a constructor that passes a subclass of GuiceJsfModule.

Author(s):
Zach Melamed
public class GuiceJsfListener extends GuiceListener
	{
		super(new GuiceJsfModule());
	}
New to GrepCode? Check out our FAQ X