|
|
@@ -1,17 +1,23 @@
|
|
|
package name.tflucke.ieat2;
|
|
|
-
|
|
|
+
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.web.servlet.ViewResolver;
|
|
|
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
|
import org.springframework.web.servlet.view.JstlView;
|
|
|
-
|
|
|
+import org.springframework.web.servlet.resource.WebJarsResourceResolver;
|
|
|
+import org.springframework.http.CacheControl;
|
|
|
+
|
|
|
@Configuration
|
|
|
@EnableWebMvc
|
|
|
@ComponentScan(basePackages = "name.tflucke.ieat2")
|
|
|
-public class WebConfig {
|
|
|
+public class WebConfig implements WebMvcConfigurer {
|
|
|
@Bean
|
|
|
public ViewResolver viewResolver() {
|
|
|
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
|
|
|
@@ -20,5 +26,13 @@ public class WebConfig {
|
|
|
viewResolver.setSuffix(".jsp");
|
|
|
return viewResolver;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
+ registry.addResourceHandler("/static/**")
|
|
|
+ .addResourceLocations("classpath:/META-INF/resources/webjars/")
|
|
|
+ //.setCacheControl(CacheControl.maxAge(0L, TimeUnit.DAYS).cachePublic())
|
|
|
+ .resourceChain(true)
|
|
|
+ .addResolver(new WebJarsResourceResolver());
|
|
|
+
|
|
|
+ }
|
|
|
}
|