I agree that static injection is fugly, it makes unit tests very sad and kills puppies, but in some cases its a necessary evil. Lets say for example that it is only needed in a very few cases, then IMO pulling in Salve is a bit of an overkill. I've tried out Salve, liked it but it's a bit of a commitment to use compile time weaving/instrumentation.
Last I checked, the InjectorHolder only worked with Spring and not with Guice. I looked into fixing that some time ago but didn't finish that work. I've got more time now if someone is interested? :) regards, Guðmundur Bjarni igor.vaynberg wrote: > > there are cases where this approach plain old sucks. > > as you mentioned, if its not a component you have to use static injection > which is fugly > > class mydataprovider implements idataprovider { > public mydataprovider() { > InjectorHolder.getInjector().inject(this); > } > } > > another problem is that the injector creates a proxy which in certain > situations cant be done. eg your dependency is a class from a 3rd party > library that does not have a default constructor, thus cglib cannot create > a > proxy. > > another advantage of salve is that it _removes_ the field from the class. > so > your classes are smaller and there are no serialization problems > whatsoever > as far as dependencies go. > > -igor > -- View this message in context: http://www.nabble.com/Salve-and-Guice-tp20087649p20100143.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]