Reputation: 2013
I created an Indexable annotation with an indexName attribute, this annotation has to be placed on top of a class, i want to add a prefix to the indexName that i define in application.yml file
application:
elasticsearch:
prefix: dev_
@Indexable(indexName = "${application.elasticsearch.prefix}address")
public class Address implements Serializable {
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Indexable {
String indexName() default "";
}
Upvotes: 2
Views: 6999
Reputation: 2286
Use the @Value("${yaml.path.to.value}") annotation on the field you want to set the value. For instance for the yaml.path.to.value :
yaml:
path:
to:
value: someValue
Be careful with the spaces when using yml.
Upvotes: 2