Skip to content

UsingGuiceWithJavaScript

Sebastian Hoß edited this page Oct 5, 2013 · 7 revisions

To use Guice together with JavaScript, declare the following dependency and replace ${contracts-version} with the latest release

<dependencies>
  <dependency>
    <groupId>com.github.sebhoss.contract</groupId>
    <artifactId>contract-guice-javascript</artifactId>
    <version>${contracts-version}</version>
  </dependency>
</dependencies>

then install the provided JavaScript module

import com.github.sebhoss.contract.module.DefaultJavaScriptModule;
import com.google.inject.AbstractModule;

public class YourModule extends AbstractModule {

    @Override
    protected void configure() {
        install(new DefaultJavaScriptModule());

        // .. your bindings
    }

}

and annotate your business methods as usual using JavaScript. Consult the example project for more details.