before you inject a service you must tell the ioc container how to
create it (in your AppModule). you can do this by using the
ServiceBinder:
public static void bind(ServiceBinder binder) {
binder.bind(MyService.class,MyServiceImpl.class);
}
Or you can provide a builder method:
public static Message buildMyMessage() {
return new MyMessage();
}
there's some information in the tapestry-ioc docs :)
g,
kris
Tina Umlandt <[EMAIL PROTECTED]>
27.06.2007 13:50
Bitte antworten an
"Tapestry users" <[email protected]>
An
Tapestry users <[email protected]>
Kopie
Thema
Re: Antwort: Messages and @inject
Hej,
I didn't add anything to my AppModule. Do I have to? Which method do you
mean?
Thx,
Tina
Kristian Marinkovic wrote:
> it should work as you've tried.... could you post the code from
> your AppModule where you return your service?
>
>
>
>
>
> Tina Umlandt <[EMAIL PROTECTED]>
> 26.06.2007 17:56
> Bitte antworten an
> "Tapestry users" <[email protected]>
>
>
> An
> Tapestry users <[email protected]>
> Kopie
>
> Thema
> Messages and @inject
>
>
>
>
>
>
> hi,
>
> I need my own implementation of the Messages interface. It works fine
with
> the new binding in the HTML-templates. But I
> have a problem to use it as a field in a the class. I tried the
following
>
> @Inject
> @Service ( "myMessages" )
> Messages _message;
>
> I hoped the Injection would know that I use my own implementation but it
> is totally ignored. The tapestry messages are
> injected.
>
> I created a little workaround by implementing a mock interface which
> extends the Messages interface so that the
> injection work properly.
>
> @Inject
> MyMessages _message;
>
> But I don't really like it that way.
>
> The question that I have is:
>
> Is this effect wanted that the user cannot inject his own Messages
> implementation or is it something nobody thought of?
>
> Thanks and regards,
> Tina
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]