Grary wrote:
Hi all,

I'd like to configure a module in Guice (Gin) such that...

public enum WeekSpanFields {
        RECURRING_TIMES(TIME_CONSTS.recurringTimes());
...
        private WeekSpanFields(String constStr) {
                ...
        }
}

where...

class Constants {
        @Inject static Provider<TimeWrapperConstants> constantsProvider;
        static final TimeWrapperConstants TIME_CONSTS =
constantsProvider.get();
}

But I keep getting null pointer exceptions at the get() call in the
code snippet immediately above.
I guess the jvm initialises your class, which means it also initialises
all fields and because constantsProvider is not yet injected its null.
Guice can only work after the jvm loaded the class, but its too late by
then.
Any thoughts on how to configure this in my module? (I hope it's
clear.)

Thanks,

Grar


--
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to