有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java spring数据solr showcase设置@SolrDocument(solrCoreName=“…”)从财产

我正在试用https://github.com/christophstrobl/spring-data-solr-showcase

我试图使代码在多个不同的环境中工作,在这些环境中,Solr核心名称可能不同。使用属性指定核心名称似乎是一种有用的方法

所以我试图设置@SolrDocument(solrCoreName=“…”)从我已添加到应用程序的属性。属性文件,如下所示:

@SolrDocument(solrCoreName = @Value("${solr.core}"))
public class Product implements SearchableProductDefinition {
    private @Id @Indexed String id;
    private @Indexed(NAME_FIELD_NAME) String name;
...
}

但我得到一个maven编译错误:

.../git/spring-data-solr-showcase/src/main/java/org/springframework/data/solr/showcase/product/model/Product.java:[31,30] annotation not valid for a value of type java.lang.String

我是春天的新手。有可能做我想做的事吗

提前谢谢


共 (0) 个答案