Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've implemented something which works but involves some slightly ugly setup... still interested in any improvements on this &amp; there may be a bit too much code to post really so just put some snippets in that hopefully illuminates</p> <p>it's a a variation on the SimpleScope example which involves;</p> <ul> <li>bringing up the spring ctx </li> <li>grabbing a specific bean out of it (that is a registry of pipeline keys) </li> <li>passing that to the Guice module along with the beanfactory</li> <li>giving that registry to the Scope impl so the scope is entered when the pipe is activated (which happens later when certain spring beans are init'ed)</li> </ul> <p>It seems I have to grab the specific bean rather than access it through a Named after doing a bindAll on the beanfactory as the Scope instance is new'ed yourself in the Module, i.e.</p> <pre><code> PipeScope&lt;SecurityId&gt; pipeScope = new PipeScope&lt;SecurityId&gt;(); pipeScope.setPipeIdRegistry(pipeIdRegistry); bindScope(Pipe.class, pipeScope); bind(PipeScope.class) .annotatedWith(Names.named("pipeScope")) .toInstance(pipeScope); SpringIntegration.bindAll(binder(), beanFactory); </code></pre> <p>The fact I have to new it means I need to explicitly provide the registry to the module, can't see a way around this as it's a chicken &amp; egg situation.</p> <p>The PipeScope basically stores values against the pipe key (actually a List of keys) as opposed to a ThreadLocal so my enter is like</p> <pre><code>public void enter(List&lt;K&gt; scopedKeys) { checkState(values.get(scopedKeys) == null, "A scoping block is already in progress"); values.put(scopedKeys, Maps.&lt;Key&lt;?&gt;, Object&gt;newHashMap()); } </code></pre> <p>all in all seems to function perfectly well... at least in my quickly knocked up test harness anyway </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload