Ok I'm going to investigate about that Registry.
So, what's the interrest to use tapestry-ioc instead of Spring ioc? If I
need my ioc to provide all the services I need, I cannot use tapestry-ioc
unless I need my other layers to call explicitely the ioc which is not
recommended when you want independant layers working together.

@Hugo, ok I'm going to reread again this part.

2007/12/14, Kristian Marinkovic <[EMAIL PROTECTED]>:
>
> hi michael,
>
> @Inject only works in Tapestry pages and components (and mixins).
> By default Tapestry will use the field type as an id and lookup the
> corresponding ioc service.
>
> I assume your Web Service Container was not started by the ioc
> container so it runs outside its control. Therefore you have to first
> obtain an ioc Registry first and then ask it explicitly for the service
> you want to call. The builder methods are not meant to be called
> except by the container :)
>
> g,
> kris
>
>
>
>
> "Michael Bernagou" <[EMAIL PROTECTED]>
> 14.12.2007 10:51
> Bitte antworten an
> "Tapestry users" <users@tapestry.apache.org>
>
>
> An
> "Tapestry users" <users@tapestry.apache.org>
> Kopie
>
> Thema
> IoC global question
>
>
>
>
>
>
> Hi,
>
> I have a sort of general question about tapestry-ioc. In fact, I would
> like
> it to manage all the services of my webapp. In theory it should be the
> case,
> shouldn't be?
>
> So to provides services to my MVC, no problem the syntax @Inject MyService
> _myService; work perfectly. But, to provide services the same way for my
> Dao
> it's different. The same syntax doesn't provide any instance.
> I used the tapestry-hibernate and declare my dao as services :
>
>   import org.hibernate.Session;
>
>   public static UserDao buildUserDao(@InjectService("Session") Session
> session) {
>       return new UserDaoImpl(session);
>   }
>
>   public static UserService buildUserService(@InjectService("UserDao")
> UserDao dao) {
>     return new UserServiceImpl(dao);
>   }
>
> So my implementation can work. But to use the service, all the callers
> have
> to know a session object!
> Ok, if my caller is a web service, and this web service want to call the
> UserService, @Inject UserService _userService; DOES NOT work and
> _userService is null! So I have to call explicitely the builder of my
> service FROM the web service... If I do that, I bypass the IoC purpose
> because I link it directly :
>
> UserService us = AppModule.buildUserService( ... and then I have a
> problem!
> buildUserService need a UserDao, but my web service doesn't care about
> knowing any kind of dao!
>
> So, I should be able to use @Inject MyService _myService; anywhere in my
> project and the tapestry-ioc should be able to give instance to all the
> class...
>
> Did I (probably) missed something?
>
> --
> Michael Bernagou
> Java Developper
>
>


-- 
Michael Bernagou
Java Developper

Reply via email to