aaa
aaa

Reputation: 1649

Spring Boot fails to load resources from subdirectories

I want to save different css and js files in different subdirectories and this is my directory structure

structure

Then I tried import all these files into my index.html file (which is mapped by "/") but none of them were imported properly. What should I configure to enable Spring boot to search for resources recursively in all subdirectories under "resources"? Also what should I do if I also want to put all html templates in subdirectories?

errors

Upvotes: 0

Views: 1143

Answers (1)

Tom
Tom

Reputation: 3850

You should remove the ../static/ as spring boot automatically expose all directories and sub-directories in the static folder on your main endpoint (default /).

so for example use:

<script src="js/jquery-1.11.8.min.js" ... />

Upvotes: 1

Related Questions