I stumbled across https://code.google.com/p/dango-net/ and copied its
Guice/Wink code, and it worked! For future reference, here is what I did
to upgrade my Wink project:

1. Changed the POM dependency from wink-server to wink-guice-server.
2. Changed the servlet-class in web.xml from
org.apache.wink.server.internal.servlet.RestServlet to
org.apache.wink.guice.server.internal.servlet.GuiceRestServlet.
3. Also in web.xml, added this init-param to the servlet:
        <init-param>
                <param-name>deploymentConfiguration</param-name>
                <param-value>com.db.myproj.DeploymentConfiguration</param-value>
        </init-param>
4. Added this class to my webapp:

package com.db.myproj;


import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;

import org.apache.wink.common.internal.lifecycle.LifecycleManagersRegistry;
import org.apache.wink.guice.server.internal.GuiceDeploymentConfiguration;
import
org.apache.wink.guice.server.internal.lifecycle.GuiceInjectorLifeCycleManag
er;
import org.apache.wink.guice.server.internal.lifecycle.WinkGuiceModule;


public class DeploymentConfiguration extends GuiceDeploymentConfiguration {
        public DeploymentConfiguration() {
                LifecycleManagersRegistry lifecycleManagersRegistry = new
LifecycleManagersRegistry();
                setOfFactoryRegistry(lifecycleManagersRegistry);
                Injector injector = Guice.createInjector(createModules());
                lifecycleManagersRegistry.addFactoryFactory(new
GuiceInjectorLifeCycleManager<Object>(injector));
        }


        @Override
        public Module[] createModules() {
                return new Module[] { new WinkGuiceModule(), new MyModule() };
        }
}

where MyModule contains my Guice bindings.


---
This communication may contain confidential and/or privileged information. If 
you are not the intended recipient (or have received this communication in 
error) please notify the sender immediately and destroy this communication. Any 
unauthorized copying, disclosure or distribution of the material in this 
communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information 
contained in this communication should not be regarded as such.

Reply via email to