-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from meltmedia/feature_guice-support
Guice Support
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
bundle/src/main/java/com/meltmedia/dropwizard/jest/guice/JestModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |