|
@@ -22,11 +22,14 @@ package edp.davinci.core.config;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.util.ResourceUtils;
|
|
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
|
|
import org.thymeleaf.templatemode.TemplateMode;
|
|
|
import org.thymeleaf.templateresolver.FileTemplateResolver;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
|
|
|
@Configuration
|
|
|
public class ThymeleafConfig {
|
|
@@ -41,8 +44,17 @@ public class ThymeleafConfig {
|
|
|
|
|
|
@PostConstruct
|
|
|
public void webResourcesResolver() {
|
|
|
+
|
|
|
+ File path = null;
|
|
|
+ try {
|
|
|
+ path = new File(ResourceUtils.getFile("classpath:").getPath());
|
|
|
+
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ System.out.println(">>>>>" + path);
|
|
|
FileTemplateResolver resolver = new FileTemplateResolver();
|
|
|
- resolver.setPrefix("/templates/");
|
|
|
+ resolver.setPrefix("./templates/");
|
|
|
resolver.setSuffix(".html");
|
|
|
resolver.setTemplateMode(TemplateMode.HTML);
|
|
|
resolver.setCharacterEncoding("UTF-8");
|