title: Spring boot automatically restarts when doing file IO from intelliJ
body: <p>I have a very strange issue where my spring application will end all threads and restart when I programmatically save a file to the resources folder. What's odd is that the problem seems to disappear if I package to war and deploy on a tomcat server, yet when I run it from IntelliJ the problem is there. What's more is that I am wanting this file write to happen right after Spring starts, leading to this infinite loop of the application starting and restarting. I check in the resources folder within the build folder and see that the file is getting save each time spring starts, but the application seems to crash right afterwards.</p>
  
  <p>Here is the code I'm using to write the file:</p>
  
  <pre><code>FileOutputStream fos = new FileOutputStream(
          this.getClass().getClassLoader().getResource("processes/").getPath() + "/filename.xml"
  );
  fos.write(processXML);
  fos.close();
  </code></pre>