Okay so let me get this straight:
Step1 bind (it has a default scope of session):
binder.bind(UserData.class).withId("DataService")
Step2:
@Inject
private UserData userData_;
And that's it?? that seems almost too easy to be true!
Kristian Marinkovic wrote:
and you can also have services withouth an interface
binder.bind(UserData.class).withId("DataService")
will also work :)
Kristian Marinkovic <[EMAIL PROTECTED]>
08.10.2007 14:29
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>
An
"Tapestry users" <users@tapestry.apache.org>
Kopie
Thema
Antwort: Re: Tapestry 5 IoC container
in T5 you don't have to define ASOs as in T4
if you want to define and use a ASO you just have
to use the @ApplicationState annotation:
@ApplicationState
private UserData userData;
the first access will force the object instantiation with
a no-arg constructor. default scope of ASOs (and the only
possible at the moment) is "session".
if you need global ASOs you can define a service in your
AppModule and inject it as you did below.
g,
kris
Peter Stavrinides <[EMAIL PROTECTED]>
08.10.2007 14:20
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>
An
Tapestry users <users@tapestry.apache.org>
Kopie
Thema
Re: Tapestry 5 IoC container
Actually I am migrating a lot of code from T4
Typically I have many Pojos used as services like this one:
public class UserData implements Serializable {
....
public UserData() {
}
}
This is an ASO session scoped in T4. In T5 in AppModule.java I have
added a binder entry:
binder.bind(UserData.class, UserDataImpl.class).withId("DataService");
UserData is expected as an interface though in T5, how do I convert
them, do have to write wrappers for all my services? what is the
efficient approach here?
I am injecting services in T5 like this, I don't know if this is correct
though?
@Inject
private RequestGlobals globals_;
@Inject
private UserData userData_;
Thanks
Peter
Robin Helgelin wrote:
On 10/8/07, Peter Stavrinides <[EMAIL PROTECTED]> wrote:
Hi All,
Sorry if this is a trivial question, I am looking for samples or a
tutorial explaining how to use Tapestry 5 IoC. I have been through the
documentation on site and there are some details I can't figure out.
It's easier to help you if you tell us the details :)
---------------------------------------------------------------------
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]