I am creating a very basic little web application using Spring Boot, thymeleaf and webjars.
What I want: include jquery and bootstrap using webjars
What I did: I included the dependencies into my pom.xml
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.1</version>
</dependency>
I added the jquery to my template index.html:
<script src="/webjars/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
Problem: Although the thymeleaf jars are in my /lib directory and everything looks correct for me, it does not work. The HTML file shown in the browser shows the script line, but trying to fetch the jquery library directly (click on source in Chrome browser) ends up to a HTTP 406 error, while the path is shown as http://localhost:8080/webjars/jquery/2.1.1/jquery.min.js
:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 17 09:34:32 CEST 2014
There was an unexpected error (type=Not Acceptable, status=406).
Could not find acceptable representation