Depends what you want to achieve. You can also have two different beans with two different clients and one accesses a core and another accesses without.
You may also want depending on your use case get all cores and ping each core individually to check if they are reachable. > Am 18.03.2019 um 21:04 schrieb Markus Schuch <markus.sch...@deutschebahn.com>: > > Hi folks, > > i have a question about how to perform a connection check with SolrJ in a > generic way. > > I found PingRequest and CoreAdminRequest in SolrJ. > Neither of both work in both scenarios when a SolrClient is created by > HttpSolrClient.Builder with AND without having the baseUrl containing the > path to a particular core: > > > * CoreAdminRequest - is only working when no particular core is given > * PingRequest - is only working when a particular core is given > > Here is a sample test case demonstrating both scenarios: > https://gist.github.com/schuch/9d86383cb36244c1b6ec0360ebf739a5 > > Is this behavior intended or might it be a bug? > Is there a better way to do a connection check? > > My use case: > I look for an improvement for the spring boot solr health indicator: > https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java > > It currently uses the CoreAdminRequest which fails when the SolrClient points > to a particular core. > > Many thanks in advance, > Markus > > ________________________________ > > Pflichtangaben anzeigen<http://www.deutschebahn.com/pflichtangaben/20190306> > > N?here Informationen zur Datenverarbeitung im DB-Konzern finden Sie hier: > http://www.deutschebahn.com/de/konzern/datenschutz