and a css file like this and a css file like this and a css file like this

How to add an image and css file in thymeleaf?

34 Views Asked by At

I am trying to add an image like this

<img th:src="@{/img/Timestamp1.jpg.png}" alt="img1"> and a css file like this

<link rel="stylesheet" href="css/index.css"> they are on correct place and are mapped correctly (i have checked that 100 times).

I have tried in SecurityConfig this but it's not giving results.

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler(
                    "/webjars/**",
                    "/img/**",
                    "/css/**",
                    "/js/**")
            .addResourceLocations(
                    "classpath:/META-INF/resources/webjars/",
                    "classpath:/static/img/",
                    "classpath:/static/css/",
                    "classpath:/static/js/");
}
0

There are 0 best solutions below