我有一个带有 Thymleaf 页面的 Spring Boot 服务器。当我不使用它时它工作正常style.css。但是当我链接一个样式表<link rel="stylesheet" type="text/css" href="../static/css/style.css" th:href="@{/css/style.css}"/>(
项目结构:
├─ pom.xml
├─ src
│ ├─ main
│ │ ├── java
│ │ │ └── com.alexesmet.example
│ │ │ ├── Application.java
│ │ │ └── controller
│ │ │ └── RootController.java
│ │ └── resources
│ │ ├── application.properties
│ │ ├── static
│ │ │ └── css
│ │ │ └── style.css
│ │ └── templates
│ │ └── index.html
│ └─ test
│ └── java
我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.alexesmet.example</groupId>
<artifactId>webshop</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
汪汪一只猫
相关分类