You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Erdinc <ko...@yahoo.com> on 2011/03/07 12:45:56 UTC
DI example
Hi,
I want try to use DI feature of Cayenne but having difficulty to find a good way to use. My application is a standalone application.
I created runtime with the command;
ServerRuntime = new ServerRuntime("cayenne-X.xml");
I think I have to implement the "configure" method of a Module object and use the Binder class. ServerRuntime creates a default module,
but I cant extend it. Do I need to add additional modules or inherit from CayenneRuntime instead of ServerRuntime or is there any better way to do this simple task??
An example in docs would be greatly appreciated.
Thanks,
---------------------------------------------------
http://www.nofailtime.com
Application monitoring
---------------------------------------------------
Re: DI example
Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi,
Actually if you don't want to extend Cayenne, you shouldn't even care about DI. Once you obtain an ObjectContext, you use it as before.
If you do need to extend/configure Cayenne, then you'll create a custom module and pass it to ServerRuntime in constructor. If you have a specific scenario, I can provide a more detailed example.
Andrus
On Mar 7, 2011, at 1:45 PM, Erdinc wrote:
> Hi,
>
> I want try to use DI feature of Cayenne but having difficulty to find a good way to use. My application is a standalone application.
> I created runtime with the command;
> ServerRuntime = new ServerRuntime("cayenne-X.xml");
> I think I have to implement the "configure" method of a Module object and use the Binder class. ServerRuntime creates a default module,
> but I cant extend it. Do I need to add additional modules or inherit from CayenneRuntime instead of ServerRuntime or is there any better way to do this simple task??
> An example in docs would be greatly appreciated.
>
> Thanks,
>
> ---------------------------------------------------
> http://www.nofailtime.com
> Application monitoring
> ---------------------------------------------------
>
>
>