Подключаем Freemarker
This commit is contained in:
@@ -8,6 +8,9 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:/application.properties")
|
||||
@@ -16,4 +19,19 @@ public class SpringConfig {
|
||||
public WebApp webapp(@Value("${webapp.host}") String host, @Value("${webapp.port}") int port) {
|
||||
return new WebApp(host, port);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ViewResolver viewResolver() {
|
||||
FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
|
||||
viewResolver.setCache(true);
|
||||
viewResolver.setSuffix(".ftl");
|
||||
return viewResolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FreeMarkerConfigurer freemarkerConfig() {
|
||||
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
|
||||
freeMarkerConfigurer.setTemplateLoaderPath("classpath:/kinosearch/kinosearch3/webpp/");
|
||||
return freeMarkerConfigurer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user