How to implement Jar package with default configuration files while allowing custom configuration files

  java, question

Suppose I now have a JAR package A.jar
It itself has a configuration file a.properties under the classpath of the jar package.

Then suppose I now have a project b, using A.jar

How to design, to achieve

I placed a b.properties under the classpath of the project, which can be read, thus overwriting the a.propertis file in the jar package and being used as a configuration by A.jar

InputStream is = null;
 try {
 is = new FileInputStream("nodes.xml");
 } catch (FileNotFoundException e) {
 is = null;
 bracket
 if (is == null) {
 is = NodesLoader.class.getClassLoader().getResourceAsStream("nodes.xml");
 bracket
 if (is == null) {
 return res;
 bracket

This is a short piece of code in my project. First of all, I will try to read the nodes.xml file under the current directory. if the file is not found, I will read the nodes.xml file in classpath. In this way, if there is no custom configuration file, the default one will be used; if there is a custom file, the custom one will be used.