0

I use gwt 2.8 anf google-gin 2.12

I would like to inject some object into a deep custom com.google.gwt.user.client.ui.composite.

For instance this composite may contain a panel which contains other UIBinded views which can contains other nested element...

DeepComposite
    \ APanel
        \ AnObjectToShare
        \ View1
        \ View2
            \ AnotherPanel
                \ AnObjectToShare
        \ View3
            \ AnObjectToShare

You can see in this hierarchy there is an AnObjectToShare I need to access at various level.

My first reflex was to inject it as Scope.SINGLETON. But today I see it too intrusive, as if I run a new activity which initialize a new DeepComposite (which is the starting point of my g-in-jection context), my previous AnObjectToShare instance is reused.

To resume I'm looking for a way to make my singletons to be singleton only on my current context. Or a way to reset my singleton. Or any other idea or workaround to resolve this issue.

Fractaliste
  • 5,777
  • 11
  • 42
  • 86

1 Answers1

0

Unfortunately, GIN doesn't support custom scopes; but maybe you could migrate to Dagger? (which would support your use case)

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164