My file "products.yml" is located in src/test/resources/configs folder. I have defined config import in my application.yml in springboot
spring:
config:
import:
- optional:configtree:src/test/resources/configs/
I am trying to get this "products.yml" filepath using @Value annotation in my configuration class
@Configuration
public class ProductConverterConfiguration {
@Value("${products}")
private String productsYamlFile;
System.out.Println("Got the file as: " + productsYamlFile);
}
Springboot is unable to see that file when I try to run bazel test for that class it fails with null pointer exception.
I tried giving absolute path in the application.yaml and it works. But I need the relative path since I wont have the same host when I deploy this application. Can someone help me with this?