search

Home  >  Q&A  >  body text

java - How to obtain ClassLoader resources in advance when springboot uses container loading?

Now directly after the springboot startup is completed, the ClassLoader.getSystemResource method is called again. The system resource cannot be obtained and is directly null. Is there any way to preload ClassLoader into a static variable or object when springboot starts?

我想大声告诉你我想大声告诉你2775 days ago706

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-17 10:02:13

    I encountered a similar problem before. Local development can access the ClassLoader.getSystemResource resource, but it cannot be accessed after the war created by SpringBoot.
    Try using ResourceUtils.getURL(usersExistingData).openStream() instead

    reply
    0
  • Cancelreply