Tapestry's IoC container runs in distinct stages; there's a setup stage which involves the analysis to identify what services exist and how they are built (i.e., including decoration, advice, lifecycle and configuration) then the operational phase, and a short shutdown phase.
The ServiceBinder() has some methods that could accomplish what you need, as long as the list of ids is known statically (does not involve asking an IoC service for it). Remember that services are not the only approach here. I would define a Vendor service whose contributions where a Map<String,MyService>. Then you can ask Vendor for for a MyService by id. Better yet, you could define your own injection resolution annotation, @InjectMyService("id"), and write an ObjectProvider for it that would be contributed to the MasterObjectProvider. On Thu, Feb 12, 2009 at 7:48 AM, foror <fo...@mail.ru> wrote: > How to create services without "static bind(ServiceBinder)" and > "buildMethod" like this: > > AppModule { > > void contributeIdContainer(Configuration<String> config) { > config.add("someId-1"); > config.add("someId-2"); > } > } > > InternalModule { > > ... > > ids = idContainer.getAll(); > > for (String id : ids) { > // build() is imaginary method for create service > build(MyService.class, > objectLocator.getService(MyServiceFactory.class).createBy(id) > .withId(id) > .scope(PERTHREAD); > } > > ... > > } > > > SomeServiceImpl { > > public SomeServiceImpl( > @InjectService("someId-1") MyService some1, > @InjectService("someId-2") MyService some2 ) {...} > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org