java - Inject Spel parameter on annotation parameter (like what is done with @Value on a field) -


i'm using annotation provided spring-starter-elastic-searchto create document , inject parameter indexname dynamically:

@entity @document(indexname = "myindex") public class stockquotation  

in bean have done using @valueon field:

@value("${elasticsearch.index.name}") public string indexname; 

however, have tried inject in same way in annotation , translation not done:

@entity @document(indexname = "${elasticsearch.index.name}") public class stockquotation 

as exception:

caused by: org.elasticsearch.indices.indexmissingexception: [${elasticsearch.index.name}] missing 

what appropriate approach this?

thanks


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -