I am able to read (value of 'fruits') from property file in my spring boot application, successfully using @Value as below.
@Value("${fruits}")
private String[] fruitarray;
from the below
file:applicaton.properties
#section_1
fruits=apple,mango,banana
#section_2
apple.native=aaaa
apple.cost=100
apple.name=xxyyzz
Now, I would like to know, how can I access the key-values from the section_2 of the properties file dynamically. I mean,... in our above code we already got array of fruits and set it to 'fruitarray' using @Value. Now how would I be accessing value for 'apple.native' by using fruitarray[0] variable in java/spring-boot way?
Thanks