-1

i have a properties file names config.properties in path: src/main/resources/config.properties, but when i try to launch the job i get Caused by: java.io.FileNotFoundException: class path resource [config.properties] cannot be opened because it does not exist. exception trace

enter image description here

Before was working but suddenly not, and i don't know thanks and sorry for my english is not my native languaje

I belive that the error is produced becouse i have in pom.xml a exclude for when generate jar the config not included but i dont underestand i get this exception

1 Answers1

0

This usually works for me:

File file = ResourceUtils.getFile("classpath:config.properties");

This method is designed to find anything under the resources folder. Be careful, as it...

...Does not check whether the file actually exists; simply returns the File that the given location would correspond to.

So, make sure to check whether the File is empty or not.

  • Hi, currently several ways are working but i don't know why mi code work and founds the properties file and another day not working yet. – roberto fernandez Jul 08 '20 at 05:10