我对Spring很陌生,无法访问我的资源。我使用Spring + Thymeleaf和我directionary结构是:Spring:找不到资源
src
- main
- java
- Application.java
- controller
- LanchController.java
- ...
- resources
- css
- test.css
- templates
- account.html
- ...
加载应用程序正确,但HTML模板没有找到CSS等 account.html:
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/css/test.css"/>
</head>
<body>
<p>Hello, User!</p>
</body>
</html>
我已经尝试了很多路径,如../css/...
或/resources/css/..
,但没有任何效果。我希望有一个人可以帮助我。我按照这个教程:https://spring.io/guides/gs/serving-web-content/
问候 Chryb
是视图解析器在WebConfig – 2014-10-20 08:47:42