我正在尝试使用Webjars将jQuery添加到我的Boot应用程序中.我从本教程中获得灵感:http: //spring.io/blog/2014/01/03/utilizing-webjars-in-spring-boot
在我的pom.xml中,我添加了:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在我的html文件中(使用ThymeLeaf作为我的模板引擎 - 不确定这是否重要)我有以下内容:
<script src="webjars/jquery/2.1.1/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
该文件未加载.我试过src ="webjars ...."和src ="/ webjars ...".
我可以看到我项目中列出的Maven依赖项中的jar.当我探索这个jar时,我可以看到META-INF/resources/webjars/jquery/2.1.1/jquery.min.js.根据我如何理解Boot寻找资源,我认为它应该找到这个.
有人看到这种行为吗?如何解决它的任何提示?