'Mariano Gonzalez' via google-guice
2018-06-19 14:33:14 UTC
Hello,
I have a case in which a portion of the binding are dynamically provided
through a properties file with the following format:
exampleService=ExampleServiceImpl
fooService=FooServiceImpl
Unlike Guice's approach, the key is not a type but an actual Name. For now,
I'm just binding those concrete types to themselves, like
*bind(FooServiceImpl.class).to(bindFooServiceImpl.class)*
Of course this approach doesn't work because then the following injection
would fail:
public class Foo {
@Inject
private FooService fooService;
}
There's no default way in which Guice would figure out that FooService can
actually be served by FooServiceImpl. The alternative that I have thought
about so far is to introspect those types and generate bindings for each
superclass and implemented interface.
I was wondering is there's a less "brute force" approach.
Thanks
I have a case in which a portion of the binding are dynamically provided
through a properties file with the following format:
exampleService=ExampleServiceImpl
fooService=FooServiceImpl
Unlike Guice's approach, the key is not a type but an actual Name. For now,
I'm just binding those concrete types to themselves, like
*bind(FooServiceImpl.class).to(bindFooServiceImpl.class)*
Of course this approach doesn't work because then the following injection
would fail:
public class Foo {
@Inject
private FooService fooService;
}
There's no default way in which Guice would figure out that FooService can
actually be served by FooServiceImpl. The alternative that I have thought
about so far is to introspect those types and generate bindings for each
superclass and implemented interface.
I was wondering is there's a less "brute force" approach.
Thanks
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/7d2ec09b-9702-4615-85f2-82f47329c9b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/7d2ec09b-9702-4615-85f2-82f47329c9b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.