Skip to content Skip to sidebar Skip to footer

Thymeleaf, Intellij And Spring Boot Not Loading Css Files Correctly

I have been experiencing this issues and each time, I only resolve it by creating a new project which appears to work. This time I intend to find out why this happens or I encounte

Solution 1:

I was able to solve the problem after a series of test to produce this problem. The problem arises when I leave my mappings general as in allowing my controller to map directly to the root mapping.

Example is

@GetMapping// Here is the problem... This was the only method in the controllerpublicStringhome() {
  return"index";
}

I fixed this by setting a mapping like

@GetMapping(value= "/")
publicStringhome() {
   return"index";
}

or by using the Class Level Mapping

@RequestMapping(value= "/")
publicclassController {

   publicStringhome() {
     return"home";
   }

}

Post a Comment for "Thymeleaf, Intellij And Spring Boot Not Loading Css Files Correctly"