Fixed usage of deprecated GzipResourceResolver in spring-static-resources
added back spring-version modification in module that hasnt been worked yet cleaned unused classes
This commit is contained in:
parent
c7ba38ffcd
commit
cde1d1c7ad
|
@ -96,6 +96,7 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<spring.version>5.1.0.RELEASE</spring.version>
|
||||||
<org.springframework.data.version>2.1.2.RELEASE</org.springframework.data.version>
|
<org.springframework.data.version>2.1.2.RELEASE</org.springframework.data.version>
|
||||||
<querydsl.version>4.1.4</querydsl.version>
|
<querydsl.version>4.1.4</querydsl.version>
|
||||||
<mysema.maven.version>1.1.3</mysema.maven.version>
|
<mysema.maven.version>1.1.3</mysema.maven.version>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.baeldung.spring;
|
package com.baeldung.spring;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.ViewResolver;
|
import org.springframework.web.servlet.ViewResolver;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
|
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
|
||||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||||
import org.springframework.web.servlet.resource.GzipResourceResolver;
|
import org.springframework.web.servlet.resource.EncodedResourceResolver;
|
||||||
import org.springframework.web.servlet.resource.PathResourceResolver;
|
import org.springframework.web.servlet.resource.PathResourceResolver;
|
||||||
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
|
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
|
||||||
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||||
|
@ -57,10 +57,10 @@ public class MvcConfig implements WebMvcConfigurer {
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
// For examples using Spring 4.1.0
|
// For examples using Spring 4.1.0
|
||||||
if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) {
|
if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) {
|
||||||
registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver()).addResolver(new PathResourceResolver());
|
registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver()).addResolver(new PathResourceResolver());
|
||||||
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
||||||
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());
|
||||||
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new GzipResourceResolver());
|
registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver());
|
||||||
}
|
}
|
||||||
// For examples using Spring 4.0.7
|
// For examples using Spring 4.0.7
|
||||||
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) {
|
else if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) {
|
||||||
|
|
Loading…
Reference in New Issue