提问

你好呀呀!想问下sql-father这个项目,打包后运行,有个使用绝对路径的相关代码导致了出现文件异常(FreeMarker模板配置的绝对路径)。怎么解决这个问题,以下是相关代码


/**
* FreeMarker 模板配置
*
* @author https://github.com/liyupi
*/
@org.springframework.context.annotation.Configuration
public class FreeMarkerConfigurationConfig {
@Bean
public Configuration configuration() throws IOException {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_29);
cfg.setDirectoryForTemplateLoading(new File("src/main/resources/templates"));
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
cfg.setWrapUncheckedExceptions(true);
cfg.setFallbackOnNullLoopVariable(false);
return cfg;
}
}


0个评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
care
内容推荐
下载 APP