spring属性solr展示设置@SolrDocument(solrCoreName ="...")来自属性

Tim*_*mes 5 java spring solr spring-mvc

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

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

所以我试图从我已添加到application.properties文件的属性中设置@SolrDocument(solrCoreName ="..."),如下所示:

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

但我得到一个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
Run Code Online (Sandbox Code Playgroud)

我是Spring的新手.有可能做我想做的事吗?

提前致谢!