Thiago H. de Paula Figueiredo wrote: > > I think the best approach would be to define this code that needs the > Registry as Tapestry-IoC services, so service injection would be > automatic. Don't forget that Tapestry-IoC is completely independent from > Tapestry-the-web-framework (tapestry-core). This would work for web or > non-web projects. In completely non-web projects, you would need to create > the Registry yourself: > http://tapestry.apache.org/tapestry5.1/tapestry-ioc/run.html. If you > really need to get services in runtime, inject the ObjectLocator service. > During the javadoc reading, i found that IOC test case implementation has used the customized registry building way as you mentioned, that's pretty convenient for tapestry testing.
> Taking a look at the TapestryFilter source, a desperate solution is to > subclass it. In this subclass, you would have a static field pointing to > the Registry instance. I would override the TapestryFilter.init(Registry > registry) so it would set the static field. > Actually, that is my last approach, i already did, i modified the TapestryFilter init() method a bit to get the Registry object, looks really invasive. It would be nice, if the tapestry framework can provide a bridge module between tapestry-core and tapestry-ioc, e.g, separate the registry initialization coding from the TapestryFilter. why not building a ioc registration management sub-module that is able to generate and maintain IOC Registry from different ioc frameworks, since the Registry is vital important. Anyway, this is the best solution so far. Thanks for the suggested solutions. -- View this message in context: http://old.nabble.com/Is-there-anyway-to-access-injected-service-instance-out-of-box--tp29020920p29027266.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org