1

I am using spring boot applications for my project. In one of the project, I need to include one config.properties file in the jar root path. enter image description here Because In my project, one of external jar is expecting this property file from file system, means root path of project.

propertieFile.load(new FileInputStream("config.properties"));

Actually I am having this property file in eclipse maven project, but its ignored while build. enter image description here Can any one of you please help. Thanks in advance.

Rathish
  • 11
  • 1

1 Answers1

-2

Use the maven standard directory layout. No further configuration is required if you use these directories, the files will be added in classpath.

For this kind of file is recomended to use the src/main/resources folder.

Using this you can use the classloader to input stream your file.

try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(fullPath)) {
    propertieFile.load(is);
} 
  • This does not resolved the issue. There are many of using cloud based applications which need the files at the root level. – Tony Edwards Sep 10 '20 at 18:16
  • @TonyEdwards yes, but the topic is asking about a config.properties inside a project/jar: "I am having this property file in eclipse maven project". – Norberto Ritzmann Dec 17 '20 at 08:15