Reputation: 865
I want to change CSS and JS default path from the resource to something else for thymeleaf.
I am using JSP as a view instead of thymeleaf but for email template, I decided to go with thymeleaf, in every search I saw spring boot by default looks into resource /static folder is there any way to force spring boot to look into another folder outside resource.
Upvotes: 0
Views: 820
Reputation: 874
If you have multiple resource folder you can add those in your classpath by extending WebMvcConfigurerAdapter
class like below. have a try
@Configuration @EnableWebMvc @ComponentScan public class WebConfig extends WebMvcConfigurerAdapter {
public ResourceBundleMessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
String[] strBaseNames = {
"ca.gc.myproject.global.myResources", //full class path of your folder
"ca.gc.myproject.user.yourResources",
};
return messageSource;
}
}
source :https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
Upvotes: 1