How does Spring Boot load static resources?

how does SpringBoot access the page? I returned the string "login" at controller. It didn"t access the login.html page. Do I need to add thymeleaf dependencies?

Feb.28,2021

by default, we only need to place static resources in the following directories to be accessed directly in the browser through url.

  • / META-INF/resources/
  • / resources/
  • / static/
  • / public/

for example, if you delegate login.html, to static, you can access http://localhost:8080/login.html directly

.

you can download the code sample yourself debug: https://gitee.com/skyarthur19.

Menu