我,我列入以下webjars到pom.xml
彈簧項目:Spring MVC的使用Thymeleaf +引導webjars
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.1</version>
</dependency>
然後,我包括在我的HTML查看以下鏈接和腳本:
<link rel="stylesheet" href="@{/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css}" />
<script src="@{/webjars/jquery/3.1.1/jquery.min.js}"></script>
<script src="@{/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js}"></script>
但它沒有工作,沒有發現映射:
[org.springframework.web.servlet.PageNotFound] (default task-15) No mapping found for HTTP request with URI [/TestPublicWeb-0.0.1-SNAPSHOT/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css] in DispatcherServlet with name 'testapp'
...所以我嘗試包括以下內容映射到servlet.xml中:
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
但有了這個,我/TestApplication
映射未發現:包括在sprinf項目以正確的方式
[org.springframework.web.servlet.PageNotFound] (default task-13) No mapping found for HTTP request with URI [/TestApplication/] in DispatcherServlet with name 'testapp'
如何應該是webjars?