package de.skuzzle.blog;

import javax.servlet.ServletContextEvent;

import org.apache.myfaces.el.unified.resolver.GuiceResolver;
import org.apache.myfaces.webapp.StartupServletContextListener;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;

/**
 * ServletContextListener for setting up our application wide injector.
 *
 * @author Simon Taddiken
 */
public class MyServletContextListener extends GuiceServletContextListener {

    private final Injector injector;
    private StartupServletContextListener startupListener;

    public MyServletContextListener() {
        // List all your modules here
        this.injector = Guice.createInjector(new JSFModule());
    }

    @Override
    protected final Injector getInjector() {
        return this.injector;
    }

    @Override
    public final void contextInitialized(ServletContextEvent event) {
        // this sets up guice servlet
        super.contextInitialized(event);

        // Get hold of the StartupServletContextListener and call it after Guice
        // has been initialized. This will perform all necessary JSF setup
        this.startupListener = this.injector.getInstance(
                StartupServletContextListener.class);
        this.startupListener.contextInitialized(event);

        // place injector into the context for the GuiceResolver to find
        event.getServletContext().setAttribute(GuiceResolver.KEY, this.injector);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        // properly tear down
        super.contextDestroyed(servletContextEvent);
        this.startupListener.contextDestroyed(servletContextEvent);
    }

}

@@ -126,72 +126,8 @@
 ver;
-%0Aimport org.apache.myfaces.webapp.StartupServletContextListener;
 %0A%0Aim
@@ -480,67 +480,8 @@
 tor;
-%0A    private StartupServletContextListener startupListener;
 %0A%0A  
@@ -890,333 +890,8 @@
 );%0A%0A
-        // Get hold of the StartupServletContextListener and call it after Guice%0A        // has been initialized. This will perform all necessary JSF setup%0A        this.startupListener = this.injector.getInstance(%0A                StartupServletContextListener.class);%0A        this.startupListener.contextInitialized(event);%0A%0A
     
@@ -1168,16 +1168,16 @@
 ar down%0A
+
         
@@ -1225,76 +1225,8 @@
 t);%0A
-        this.startupListener.contextDestroyed(servletContextEvent);%0A
     

remove unnecessary code