Git Product home page Git Product logo

Comments (6)

KweilinFang avatar KweilinFang commented on July 22, 2024

怎么解决的?如果解决了告知一下。我也学习学习

from sql-father-backend-public.

NiuTFei avatar NiuTFei commented on July 22, 2024

我看到一个文章是解决类似的问题的,https://www.jb51.net/article/243231.htm,但是没有尝试

from sql-father-backend-public.

Bemege avatar Bemege commented on July 22, 2024

参考 #8 (comment)

from sql-father-backend-public.

gongwx avatar gongwx commented on July 22, 2024

换一种加载方式即可 cfg.setClassForTemplateLoading(this.getClass(), "/templates");

from sql-father-backend-public.

zhaohaoyun avatar zhaohaoyun commented on July 22, 2024

问题的原因是加载模板目录方法错误,setDirectoryForTemplateLoading在IDE运行没问题,但是打包发布以后没办法从jar包直接加载文件路径
正确解决方法:
cfg.setDirectoryForTemplateLoading(new File("src/main/resources/templates"));
修改为
cfg.setClassForTemplateLoading(this.getClass(),"templates");

项目中只要修改两个地方
com.yupi.sqlfather.config.FreeMarkerConfigurationConfig
com.yupi.sqlfather.FreeMarkerTest

from sql-father-backend-public.

wdx6 avatar wdx6 commented on July 22, 2024

非常感谢,我成功了

from sql-father-backend-public.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.