关于 toServicePath 文件路径指向

来源:6-2 controller层和service层代码生成

慕粉1542476468

2021-02-23

    public class ServerGenerator {
    static String toServicePath = "server/src/main/java/com/course/server/service/";


    public static void main(String[] args) throws IOException, TemplateException {
        // 定义 service.ftl 模板中的模板参数
        String Domain = "Section";
        String domain = "section";
        Map<String, String> map = new HashMap<>();
        map.put("Domain", Domain);
        map.put("domain", domain);

        FreemarkerUtil.initFtl("service.ftl");
        FreemarkerUtil.generator(toServicePath + Domain + "Service.java",map);
    }
}

toServicePath指定的路径为生成最终文件的路径,这里开头的server为什么指向server模块,难道不应该指向当前该文件所在文件夹的位置么?

写回答

1回答

甲蛙

2021-02-24

toServicePath 是最终我生成的文件要放在哪个目录,到这一步是生成service层代码,service层代码放在server模块,所以用这个路径

0
3
慕粉1542476468
回复
甲蛙
好的,非常感谢!
2021-02-25
共3条回复

Spring Cloud+ Vue前后端分离开发企业级在线视频系统

全网稀缺课程 市场热门项目+主流框架 一课掌握前后端技术

1743 学习 · 1697 问题

查看课程