You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Jason Rutherglen <ja...@gmail.com> on 2009/07/14 23:06:18 UTC

Dependency Injection?

Are we looking at implementing dependency injection for the config files?
I'd like to think about this as we also look at integrating Zookeeper for
config file management. I was trying (for example) to use
LogByteSizeMergePolicy however currently I can't set the parameters because
solrconfig.xml only accepts a class name. Adding custom dependency injection
just for this class doesn't seem ideal, nor is rolling out our own
dependency injection? There's a couple of choices: * Spring - It's in wide
use, however it grows brittle and very difficult to maintain over time. I'd
personally rather focus on search, not managing webs of xml files. Some
companies have extended Spring to get around other limitations, I don't
think we want to go down that path? * Guice
http://code.google.com/p/google-guice/ Pluses: Apache Licensed and it's
integrated with Java so there's no problems with misspellings, type safety.
Because it's in Java it gets around Spring's biggest drawback to me which is
the inability to easily navigate the XML files.

Re: Dependency Injection?

Posted by Donovan Jimenez <dj...@conduit-it.com>.
guice and spring are trying to standardize those annotations through  
the JCP to try and eliminate the tie in with a particular DI  
framework (minus the actual configuration). Bob lee has a post about  
it (developer of Guice):

http://crazybob.org/2009/05/announcing-javaxinjectinject.html

So using guice annotations now would be transitional to standard  
annotations later theoretically. Of course, that's assuming the  
momentum keeps moving forward with their submission.


On Jul 14, 2009, at 5:30 PM, Mark Miller wrote:

> On Tue, Jul 14, 2009 at 5:06 PM, Jason Rutherglen <
> jason.rutherglen@gmail.com> wrote:
>
>> Are we looking at implementing dependency injection for the config  
>> files?
>> I'd like to think about this as we also look at integrating  
>> Zookeeper for
>> config file management. I was trying (for example) to use
>> LogByteSizeMergePolicy however currently I can't set the  
>> parameters because
>> solrconfig.xml only accepts a class name. Adding custom dependency
>> injection
>> just for this class doesn't seem ideal, nor is rolling out our own
>> dependency injection? There's a couple of choices: * Spring - It's  
>> in wide
>> use, however it grows brittle and very difficult to maintain over  
>> time. I'd
>> personally rather focus on search, not managing webs of xml files.  
>> Some
>> companies have extended Spring to get around other limitations, I  
>> don't
>> think we want to go down that path? * Guice
>> http://code.google.com/p/google-guice/ Pluses: Apache Licensed and  
>> it's
>> integrated with Java so there's no problems with misspellings,  
>> type safety.
>> Because it's in Java it gets around Spring's biggest drawback to  
>> me which
>> is
>> the inability to easily navigate the XML files.
>>
>
> We have discussed a few times in the past. A nice benefit is that,  
> while we
> can provide an injector framework with Solr, it should be easy to  
> plugin
> another (though not necessarily with annotations) of your own  
> choosing.
>
> I liked Guice a lot when I used it a couple years back - wasn't it
> annotation only though? Not sure I like the idea of Guice  
> annotations all
> throughout Solr.
>
> Noble has started some work towards this by beginning to move all  
> of the
> solrconfig parsing to one class. Ryan also did some work towards  
> this, and I
> think there is a branch with his work, though I'm sure its way out  
> of date
> now.
>
> -- 
> -- 
> - Mark
>
> http://www.lucidimagination.com


Re: Dependency Injection?

Posted by Mark Miller <ma...@gmail.com>.
On Tue, Jul 14, 2009 at 5:06 PM, Jason Rutherglen <
jason.rutherglen@gmail.com> wrote:

> Are we looking at implementing dependency injection for the config files?
> I'd like to think about this as we also look at integrating Zookeeper for
> config file management. I was trying (for example) to use
> LogByteSizeMergePolicy however currently I can't set the parameters because
> solrconfig.xml only accepts a class name. Adding custom dependency
> injection
> just for this class doesn't seem ideal, nor is rolling out our own
> dependency injection? There's a couple of choices: * Spring - It's in wide
> use, however it grows brittle and very difficult to maintain over time. I'd
> personally rather focus on search, not managing webs of xml files. Some
> companies have extended Spring to get around other limitations, I don't
> think we want to go down that path? * Guice
> http://code.google.com/p/google-guice/ Pluses: Apache Licensed and it's
> integrated with Java so there's no problems with misspellings, type safety.
> Because it's in Java it gets around Spring's biggest drawback to me which
> is
> the inability to easily navigate the XML files.
>

We have discussed a few times in the past. A nice benefit is that, while we
can provide an injector framework with Solr, it should be easy to plugin
another (though not necessarily with annotations) of your own choosing.

I liked Guice a lot when I used it a couple years back - wasn't it
annotation only though? Not sure I like the idea of Guice annotations all
throughout Solr.

Noble has started some work towards this by beginning to move all of the
solrconfig parsing to one class. Ryan also did some work towards this, and I
think there is a branch with his work, though I'm sure its way out of date
now.

-- 
-- 
- Mark

http://www.lucidimagination.com