I want to set values Spring SolrDocument Collection based on application.yml value.
@Data
@SolrDocument(collection = @Value("${solr.core}"))
public class SearchableProduct {
}
I want to set values Spring SolrDocument Collection based on application.yml value.
@Data
@SolrDocument(collection = @Value("${solr.core}"))
public class SearchableProduct {
}
Copyright © 2021 Jogjafile Inc.
Hoi Michela,
Ok, I had the same Problem and I found a solution: SpEL
it is described in details here:Spring Data for Apache Solr
you have to add the EL-expression to the Annotation
you have to provide a the serverSolrContext Bean with the method getCollectionName().
you have to write in our application.properties the following core entry.
That's it actually, BUT
if you get the following Exception, so as I did:
org.springframework.expression.spel.SpelEvaluationException: EL1057E: No bean resolver registered in the context to resolve access to bean
You have to have the following in your Configuration Bean
The last 3 Methods are doing the Trick, that cost me a while to find the right solution:
it is here, so actually I was lucky to find this:
Allow PropertyPlaceholders in @SolrDocument solrCoreName