I have the following structure
The dependencies i use:
- spring-boot-starter
- spring-boot-starter-test
- spring-boot-starter-web
- spring-boot-starter-thymeleaf
- spring-boot-starter-security
- thymeleaf-extras-springsecurity5
- mysql-connector-java
- spring-boot-starter-data-jpa
@EnableWebMvc
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/icon/**").addResourceLocations("classpath:/static/img/icon/");
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
}
}
I have tried these in index.html
<img src="icon/signin.svg">
<img src="/icon/signin.svg">
<img src="./icon/signin.svg">
<img src="../static/img/icon/signin.svg">
unsuccesfully. In addition i tried to move resources directory to main directory, nothing. Any idea?