Also your files/resources should exists under tests/resources.
The folder structure should look like:
-src
-- test
--- resources
--- your-custom-folder
--- template.json
Then try:
AnyTestClass.class.getClassLoader().getResource("your-custom-folder/template.json")
or try the below:
AnyTestClass.class.getClassLoader().getResourceAsStream("your-custom-folder/template.json")
If it is a class that is not a Test class, then your resources should be under src/main/resources/your-custom-folder/template.json
Then its Index.class.getClassLoader().getResource()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…