我正在为嵌入式Solr创建bean,以便在Junit中进行测试,如下所示:
@Bean(name = "solrServer")
public SolrClient solrServerFactoryBean() {
EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactoryBean();
factory.setSolrHome("classpath:solr");
return factory.getSolrClient("xx");
}
/**
* Initiate SolrTemplate bean.
*
* @return {@link SolrTemplate}
* @throws Exception throws exception when error occurs when creating SolrTemplate bean.
*/
@Bean
public SolrTemplate solrTemplate() throws Exception {
return new SolrTemplate(solrServerFactoryBean());
}
但是当我运行应用程序时,它显示错误:
引起:java.nio.file.InvalidPathException:非法的char<:>在索引2:/ C:/ dev / project-service / target / test-classes / solr
任何人都可以帮助我吗?