0

I want to define global variable in application yaml like this:

thresholdValue : 5

and I want to use this in the code like this (i don't know usage but for example):

if(application.yaml{"thresholdValue"} >= value){
......
}

i searched this question but i found different answers. How can i do this?

gurkan
  • 509
  • 1
  • 4
  • 18
  • 2
    you can add it in a properties file, and use it with: @Value("$thresholdValue}")private int myValue; – Stultuske May 19 '21 at 12:02
  • Does this answer your question? [How to access a value defined in the application.properties file in Spring Boot](https://stackoverflow.com/questions/30528255/how-to-access-a-value-defined-in-the-application-properties-file-in-spring-boot) – crizzis May 19 '21 at 17:49
  • @crizzis similar but i think my question is a little bit different from this. – gurkan May 19 '21 at 19:06

0 Answers0