I am using springboot with thymeleaf to develop a website. The framework can load bootstrap css files cerrectly when not using uritemplating, but when I change to uritemplating then bootstrap css breaks.
This works perfectly
@GetMapping("/update_avatar")
public String update_avatar(){
return "update_avatar";
}
This breaks css loading
@GetMapping("/update_avatar/{userid}")
public String update_avatar(@PathVariable String userid){
System.out.println("Testing Variable: "+userid);
return "update_avatar";
}
Here is how I include my stylesheet
<link rel="stylesheet" type="text/css"
href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" th:href="@{/css/main.css}"/>
<link rel="stylesheet" th:href="@{/css/tutors.css}"/>
Please note that I included Bootstrap using maven by doing the following
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
I tried to implement viewRsolver based on this solution but it did not work for me CSS not loading in Spring Boot