Guice Inject annotation in scala Guice Inject annotation in scala elasticsearch elasticsearch

Guice Inject annotation in scala


Try this instead:

class PlusSignAnalyzerProvider @AssistedInject() (index: Index,                                   @IndexSettings indexSettings: Settings,                                   env: Environment,                                   @Assisted name: String,                                   @Assisted settings: Settings)  extends AbstractIndexAnalyzerProvider[PlusSignAnalyzer](index, indexSettings, name, settings) {  val analyzer: PlusSignAnalyzer = new PlusSignAnalyzer()  def NAME = "plus_sign"  override def get(): PlusSignAnalyzer = {    this.analyzer  }}

The annotation is on the constructor rather than the class object. You need the extra set of parens so that it doesn't try to use your various arguments as part of the construction of the Inject annotation.

You will also need to make sure the other elements in there are bound (Index, Settings, and Environment)—which since you haven't posted your Module object I can't tell whether they are bound correctly, as well as that you are using the correct semantics for doing assisted inject correctly.