I have a spring boot application which reads some passwords from an xml while, which is not part of the jar.
It has to be in a separate folder. How can I add this xml file to the classpath so that
getResourceAsStream("myxml.xml") should work?
MyConfig myConfig = null; //before JAXBContext jaxbContext = JAXBContext.newInstance(MyConfig.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); //This should work InputStream is = this.getClass().getClassLoader().getResourceAsStream("myxml.xml"); myConfig = (MyConfig) jaxbUnmarshaller.unmarshal(is); //After