I'm using this annotation provided by spring-starter-elastic-search
to create a document and I would like to inject the parameter indexname
dynamically:
@Entity
@Document(indexName = "myindex")
public class StockQuotation
In another bean I have successfully done that by using @Value
on a field:
@Value("${elasticsearch.index.name}")
public String indexName;
However, I have tried to inject it in the same way in the annotation and the translation is not done:
@Entity
@Document(indexName = "${elasticsearch.index.name}")
public class StockQuotation
As I get this exception:
Caused by: org.elasticsearch.indices.IndexMissingException: [${elasticsearch.index.name}] missing
What would be the appropriate approach to do this?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire