Re: inject DataSourceFactory

2014-08-18 Thread Tore Halset
Thank you very much Andrus! It works great! :) - Tore. On 18 Aug 2014, at 16:25, Andrus Adamchik wrote: > Hi Tore, > > Wrap it in a Module, and use bind .. toInstance: > > Module m = new Module() { > @Override > public void configure(Binder binder) { > binder.bind(DataSourceFactory.

Re: inject DataSourceFactory

2014-08-18 Thread Andrus Adamchik
Oh and if you are on java 8 you can probably use a lambda, so I haven’t tried myself yet: new ServerRuntime(“cayenne-mydomain.xml”, binder -> binder.bind(DataSourceFactory.class).toInstance(myFactory)); Andrus On Aug 18, 2014, at 5:25 PM, Andrus Adamchik wrote: > Hi Tore, > > Wra

Re: inject DataSourceFactory

2014-08-18 Thread Andrus Adamchik
Hi Tore, Wrap it in a Module, and use bind .. toInstance: Module m = new Module() { @Override public void configure(Binder binder) { binder.bind(DataSourceFactory.class).toInstance(myFactory); } } runtime = new ServerRuntime(“cayenne-mydomain.xml”, m); Or if you are not averse to

inject DataSourceFactory

2014-08-18 Thread Tore Halset
Hello. How should I inject a custom DataSourceFactory? I have tried this, but it still try to use the DataSourceFactory in the model. This is going to have multiple ServerRuntimes - one for each database. runtime = new ServerRuntime(“cayenne-mydomain.xml"); runtime.getInjector().injectM