关于 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回答
-
toServicePath 是最终我生成的文件要放在哪个目录,到这一步是生成service层代码,service层代码放在server模块,所以用这个路径
032021-02-25
相似问题