Comment #1 on issue 746 by [email protected]: Original initialized instance values get lost after gucie injection
http://code.google.com/p/google-guice/issues/detail?id=746

Calling injector.injectMembers(instance) asks Guice inject any fields or setter methods in the instance that are declared with @Inject. Guice has no way to know that these fields have already been injected, for example they could have default values that should be overwritten by the configured value.

The safest way to avoid this kind of re-injection, when you're using multiple injection frameworks to configure the same instance, is to use constructor injection for the primary properties. You can then use setter or field injection for any secondary properties supplied by the other framework.

If constructor injection is not an option then you could always use setter injection, and put a guard condition in your setter methods to ignore subsequent calls.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

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


Reply via email to