I'm new to Spring mvc and I'm trying to do a web project, I could load a simple page without styles, but when I want to upload images or css I do not take the route, I would like to know how I can implement it, and try many answers that I saw in the web but none of them work for me, the last implementation that I tried was with the following configuration:
public void addResourceHandlers(ResourceHandlerRegistry registry) {
ResourceHandlerRegistration resourceRegistration = registry
.addResourceHandler("resources/**");
resourceRegistration.addResourceLocations("/resources/**");
registry.addResourceHandler("/css/**").addResourceLocations("/css/**");
registry.addResourceHandler("/img/**").addResourceLocations("/img/**");
registry.addResourceHandler("/js/**").addResourceLocations("/js/**");
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
in the jsp file:
<img src="<c:url value='/resources/img/perfil.jpg' />" class="rounded-circle mx-auto "alt="IMAGEN_Perfil" style="width: 30%">
I have the files saved in the WebContent \ resources folder but still do not load the resources, could you tell me what I should do to load them? thank you very much.