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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -