KpsLok
KpsLok

Reputation: 903

Spring Boot Thymeleaf doesnt load static files

Im having the same problem as mentioned here: Spring Boot Thymeleaf static content doesn´t load

My project Structure is the same as follow.

But my scene is:

Im getting 404 error looking the console, like:

Request URL:http://localhost:8080/dist/css/meuestilo.css
Request Method:GET
Status Code:404 
Remote Address:[::1]:8080

From Spring console, i get:

2017-02-15 23:44:23.160  WARN 8260 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/dist/css/meuestilo.css] in DispatcherServlet with name 'dispatcherServlet'

My link tag is:

<link rel="stylesheet" type="text/css" href="/dist/css/meuestilo.css" th:href="@{/dist/css/meuestilo.css}" />

What is wrong?

The template was created following this tutorial: http://blog.codeleak.pl/2013/11/thymeleaf-template-layouts-in-spring.html

Before changes, it works perfectly!

Upvotes: 1

Views: 581

Answers (2)

KpsLok
KpsLok

Reputation: 903

I find a solution using:

layout:decorator 

As mentioned here Thymeleaf Layout Documentation

Upvotes: 1

sparrow
sparrow

Reputation: 1875

As referring to your first link i believe that your meuestilo.css should be inside static/dist/css/meuestilo.css So your link tag should be like this,

<link rel="stylesheet" href="./dist/css/meuestilo.css">

Upvotes: 0

Related Questions