I am currently working on a project using spring MVC and Thymeleaf. I have encountered an issue regarding how to reference my CSS files within my folder structure:
src
main
webapp
resources
myCssFolder
myCssFile.css
web-inf
spring
views
myViewFolder
index.html
This is what my configuration class looks like:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("/css/**");
registry.addResourceHandler("/img/**").addResourceLocations("/img/**");
registry.addResourceHandler("/js/**").addResourceLocations("/js/**");
registry.addResourceHandler("/sound/**").addResourceLocations("/sound/**");
registry.addResourceHandler("/fonts/**").addResourceLocations("/fonts/**");
}
In my index file, I reference the CSS as follows:
href="resources/css/bootstrap.min.css"
However, I am experiencing some issues with certain elements on the page not displaying correctly, such as the CSS not being applied properly.