Skip to content

Commit

Permalink
Merge pull request #1 from meltmedia/feature_guice-support
Browse files Browse the repository at this point in the history
Guice Support
  • Loading branch information
ctrimble committed Apr 23, 2015
2 parents c4feb0f + fbcdbab commit 7550895
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0-beta5</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.meltmedia.dropwizard.jest.guice;

import io.searchbox.client.JestClient;

import javax.inject.Singleton;

import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.meltmedia.dropwizard.jest.JestBundle;

public class JestModule extends AbstractModule {

JestBundle<?> bundle;

public JestModule( JestBundle<?> bundle ) {
this.bundle = bundle;
}

@Override
protected void configure() {
// all bindings in provider methods.
}

@Provides
@Singleton
public JestClient provideClient() {
return bundle.getClientSupplier().get();
}
}

0 comments on commit 7550895

Please sign in to comment.