I am using spring-boot-starter-web latest version 2.2.6.RELEASE. I need to get value from yml file based on my input instead of @value.
If the count is 100, need to get the following values
key1: value1 100
key2: value2 100
If the count is 1000, need to get the following values
key1: value1 1000
key2: value2 1000
How can I achieve this?
My application.yml file,
config:
host: http://myhost
count-100:
key1: value1 100
key2: value2 100
count-1000:
key1: value1 1000
key2: value2 1000
count-10000:
key1: value1 10000
key2: value2 10000
Java code,
int count = myObject.getCount();
if (count >= 100) {
// this needs to fill from application.yml
key1 = "";
key2 = 0;
} else if (count >=1000 && count <= 10000) {
key1 = "";
key2 = 0;
} else {
key1 = "";
key2 = 0;
}
Any inputs here highly appreciated.