[REVIEW] Make controller instantiation customizable
Tom Schindl
tom.schindl at bestsolution.at
Fri Dec 16 00:51:46 PST 2011
Am 16.12.11 02:18, schrieb Greg Brown:
>> But what Dan wants to do is to go from a string to an instance using a DI lookup, not from a string to a class to an instance. How does the combination of ClassLoader + ControllerFactory solve that?
>
> Can you be more specific? In other words, how does using a type argument vs. a string argument not permit that? I'm no expert on DI, but I know that we had a similar requirement in Pivot (developers wanted to use Spring and Guice to instantiate controllers) and a Class was sufficient in both of those cases.
>
The problem in DI is that for a given type (MyType) you can have
multiple registrations.
> public class ExampleModule extends AbstractModule {
>
> @Override
> protected void configure() {
> bind(MyBean.class).annotatedWith(Names.named("t1")).to(MyType.class);
> bind(MyBean.class).annotatedWith(Names.named("t2")).to(MyType.class);
> }
>
> }
If you now want to look up the type in the injector having MyType is not
enough but you need t1, t2.
Tom
--
B e s t S o l u t i o n . a t EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833
http://www.BestSolution.at phone ++43 512 935834
More information about the openjfx-dev
mailing list