AthelticsBuilder builder = new AthelticsBuilder()
.withTicketIssuer(ResultRecorded.class) // <-- This is a singleton, one ticket issuer per event
.withObserver(ResultRecorded.class) // <--- This is race-scoped, one created per race
.addRace("100 meter sprint")
.build();
public class ResultRecorder implements RaceObserver { @Inject
public ResultRecorder(Race race, StopWatch watch) { /* ... */ }}
public class TicketMachine implements TicketIssuer {
@Inject public TicketMachine(StopWatch watch) { /* ... */ }}
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot access Key[type=com.acme.StopWatch, annotation=[none]] outside of a scoping block at com.acme.RaceScopeModule.configure(RaceScopeModule.java:25) while locating com.acme.StopWatch for parameter 0 at com.acme.TicketMachine.<init>(TicketMachine.java:85) while locating com.acme.TicketMachine
--
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 http://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/9a4d8bd2-114c-4795-b8ca-90902ab9b984%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yup, for our internals we actually have a two-pronged approach where we try to eagerly validate whatever we can (using getAllBindings) at startup, and then continue to monitor for any stragglers using a ProvisionListener.
sam
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/d748c616-0001-4201-a170-a914b6f3bdab%40googlegroups.com.