You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Donyee <xy...@gmail.com> on 2007/05/20 16:12:23 UTC
May I use the tapestry-ioc other packages?
I try to use the Tapestry-ioc in the other packages,not just in the
.pages.* package.
Does it support this?
I try to use @Inject in my domain.service.Impl.AccountServiceImpl.java
code: @Inject private AccountDao dao;
but it doesn't work!
Any suggestion?
----徐 依伟
Re: May I use the tapestry-ioc other packages?
Posted by Howard Lewis Ship <hl...@gmail.com>.
You can create modules and use the IoC annotations to build services.
However, the "magic" injection into private fields is part of Tapestry's
very aggressive bytecode enhancement of component classes. It's not
available for ordinary classes (I'd tend to call them data- or
model-classes) outside of the controlled Tapestry packages (.pages,
.components and .base).
Basically, once Tapestry gets done working over a component class, it isn't
good outside of Tapestry, it isn't even instantiable.
For services, you place an
org.apache.tapestry.ioc.annotations.Injectannotation on a parameter of
your service implementation constructor. Or
more likey, don't bother to annotate and Tapestry IoC will select the
correct service or object to inject automatically.
On 5/20/07, Donyee <xy...@gmail.com> wrote:
>
> I try to use the Tapestry-ioc in the other packages,not just in the
> .pages.* package.
> Does it support this?
> I try to use @Inject in my domain.service.Impl.AccountServiceImpl.java
> code: @Inject private AccountDao dao;
> but it doesn't work!
>
> Any suggestion?
>
>
>
> ----徐 依伟
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com