Skip to content
Advertisement

No mapping for static-resources Spring Boot

In my Spring-Boot application, js and css files do not work, it says 404 not found.

My html-page includes the following:

JavaScript

I configured resources so:

JavaScript

But in logs I receive:

JavaScript

This is the location of static-sources:

sources

What am I doing wrong?

Advertisement

Answer

By default, this handler serves static content from any of /static, /public, /resources, and /META-INF/resources directories that are on the classpath. Since src/main/resources is typically on the classpath by default, we can place any of these directories there.

This means that your links should look like:

JavaScript

instead of

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement