+1 to experimenting with DI! One thing that should probably be incorporated into the SIP and resolved at some level is that Solr does have some "non-homegrown" DI currently. Jersey, the JAX-RS framework we're using to serve our v2 APIs, allows some minimal DI in the resource classes that it instantiates by its use of a library called "HK2" (which implements JSR330). [1]. We don't do too much fancy with this - mostly just injecting already-existing "SolrCore" and "CoreContainer" objects into API classes.
That's about as far as my knowledge goes, unfortunately. I imagine we'd want to use a single JSR330 implementation throughout Solr if we want to expand our use of DI, but I can't weigh in much on the tradeoffs of picking HK2 vs Dagger vs <other>. Hopefully Jersey allows users to swap out other JSR330 implementations, but I can't say for certain. Best, Jason [1] https://javaee.github.io/hk2/ On Tue, Sep 26, 2023 at 9:08 AM Justin Sweeney <justin.sweene...@gmail.com> wrote: > > +1 on this SIP and a POC would make sense. I think it could be > valuable to update the Motivation section with the anticipated value > provided by this SIP, i.e. reduced code maintenance, removing brittle > home-grown interfaces, etc. Most of my IOC/DI experience is with > Spring and Dagger seems like a better choice here given the size and > complexity of the Spring libraries. > > On Tue, Sep 26, 2023 at 8:30 AM Jan Høydahl <jan....@cominvent.com> wrote: > > > > This is the discuss thread for SIP-19 > > > > JIRA: https://issues.apache.org/jira/browse/SOLR-16998 > > SIP link: > > https://cwiki.apache.org/confluence/display/SOLR/SIP-19+Adopt+JSR-330+dependency+injection > > > > Use a standardized dependency injection in Solr instead of our home grown > > @SolrCoreAware, @ResourceLoaderAware, @SchemaAware etc. > > Proposal is to do a trial with Dagger2 (https://github.com/google/dagger) > > which is a compile-time depenency injection framework. > > > > Let's keep discussion here on the list. > > SIP document will be kept up to date with feedback from this discussion > > Code discussion on the JIRA (if/when we get there) > > > > > > I do not have any expereince with Dagger myself, and have not done any > > deeper analysis of feasibility, or whether another framework is more > > suitable for our use. I think first step would be a POC with a limited > > scope. > > > > Jan > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@solr.apache.org > > For additional commands, e-mail: dev-h...@solr.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@solr.apache.org > For additional commands, e-mail: dev-h...@solr.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@solr.apache.org For additional commands, e-mail: dev-h...@solr.apache.org