/*
 * Copyright 2010-2013 Ning, Inc.
 *
 * Ning licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package org.killbill.billing.server.filters;

import javax.inject.Inject;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;

import org.killbill.billing.server.updatechecker.UpdateChecker;
import org.skife.config.ConfigSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.servlet.GuiceFilter;

public class KillbillGuiceFilter extends GuiceFilter {

    private static final Logger log = LoggerFactory.getLogger(KillbillGuiceFilter.class);

    @Inject
    private ConfigSource configSource;

    @Override
    public void init(final FilterConfig filterConfig) throws ServletException {
        super.init(filterConfig);

        // At this point, Kill Bill server is fully initialized
        log.info("Kill Bill server has started");

        final UpdateChecker checker = new UpdateChecker(configSource);
        checker.check(filterConfig.getServletContext());
    }
}

@@ -667,36 +667,8 @@
 s;%0A%0A
-import javax.inject.Inject;%0A
 impo
@@ -698,16 +698,16 @@
 Config;%0A
+
 import j
@@ -898,16 +898,51 @@
 ctory;%0A%0A
+import com.google.inject.Injector;%0A
 import c
@@ -1131,60 +1131,8 @@
 );%0A%0A
-    @Inject%0A    private ConfigSource configSource;%0A%0A
     
@@ -1367,24 +1367,280 @@
 started%22);%0A%0A
+        // The magic happens in KillbillGuiceListener%0A        final Injector injector = (Injector) filterConfig.getServletContext().getAttribute(Injector.class.getName());%0A        final ConfigSource configSource = injector.getInstance(ConfigSource.class);%0A
         fina

fix injection in KillbillGuiceFilter