I've been trying to get this working but no luck after several hours.
My structure is like this:
π src
ββββ π main
ββββ π java
ββββ π resources
ββββ π META-INF
β ββββ π resources
β ββββ π bootstrap
β ββββ π css
β ββββ π js
ββββ π templates
β ββββ index.html
ββββ application.properties
Here is the WebConfig class:
@Configuration
@EnableWebMvc
public class WebAppConfig extends WebMvcConfigurerAdapter {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations("/resources/");
}
}
If I use link to a web resource, it works:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></link>
If I'm trying to include a static resource, it doesn't work:
<link type="text/css" rel="stylesheet" href="../../../resources/bootstrap/css/bootstrap.min.css"
data-th-href="@{/resources/bootstrap/css/bootstrap.min.css}" />
Any help is highly appreciated.
Thank you