From b554be8165c070f815f6695c8e054617c7db7635 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 18 Jul 2021 22:57:23 +0800 Subject: [PATCH] fix: #1417 (#1427) --- .../halo/app/config/HaloMvcConfiguration.java | 22 ------------------- src/main/resources/application.yaml | 1 + 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/main/java/run/halo/app/config/HaloMvcConfiguration.java b/src/main/java/run/halo/app/config/HaloMvcConfiguration.java index 31be3f40a..983047b26 100644 --- a/src/main/java/run/halo/app/config/HaloMvcConfiguration.java +++ b/src/main/java/run/halo/app/config/HaloMvcConfiguration.java @@ -45,15 +45,12 @@ import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; import run.halo.app.config.properties.HaloProperties; import run.halo.app.core.PageJacksonSerializer; import run.halo.app.core.freemarker.inheritance.ThemeExtendsDirective; import run.halo.app.factory.StringToEnumConverterFactory; -import run.halo.app.model.support.HaloConst; import run.halo.app.security.resolver.AuthenticationArgumentResolver; /** @@ -210,23 +207,4 @@ public class HaloMvcConfiguration implements WebMvcConfigurer { public void addFormatters(FormatterRegistry registry) { registry.addConverterFactory(new StringToEnumConverterFactory()); } - - /** - * Configuring view resolver - * - * @param registry registry - */ - @Override - public void configureViewResolvers(ViewResolverRegistry registry) { - FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); - resolver.setAllowRequestOverride(false); - resolver.setCache(false); - resolver.setExposeRequestAttributes(false); - resolver.setExposeSessionAttributes(false); - resolver.setExposeSpringMacroHelpers(true); - resolver.setSuffix(HaloConst.SUFFIX_FTL); - resolver.setContentType("text/html; charset=UTF-8"); - registry.viewResolver(resolver); - } - } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 1fdae9bfd..e89c81126 100755 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -41,6 +41,7 @@ spring: template-loader-path: - file:///${halo.work-dir}/templates/ - classpath:/templates/ + expose-spring-macro-helpers: false management: endpoints: web: