From 6016a621910252f2851312c881171d58f3a8befb Mon Sep 17 00:00:00 2001 From: Jeff Butler Date: Sun, 19 Dec 2021 13:17:24 -0500 Subject: [PATCH] Initialize the full context before generating files This allows for plugins to know about all items in a context. Resolves #753 --- .../main/java/org/mybatis/generator/config/Context.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/mybatis-generator-core/src/main/java/org/mybatis/generator/config/Context.java b/core/mybatis-generator-core/src/main/java/org/mybatis/generator/config/Context.java index 7fb793ca4c..53f94fa408 100644 --- a/core/mybatis-generator-core/src/main/java/org/mybatis/generator/config/Context.java +++ b/core/mybatis-generator-core/src/main/java/org/mybatis/generator/config/Context.java @@ -447,11 +447,16 @@ public void generateFiles(ProgressCallback callback, } } + // initialize everything first before generating. This allows plugins to know about other + // items in the configuration. for (IntrospectedTable introspectedTable : introspectedTables) { callback.checkCancel(); - introspectedTable.initialize(); introspectedTable.calculateGenerators(warnings, callback); + } + + for (IntrospectedTable introspectedTable : introspectedTables) { + callback.checkCancel(); generatedJavaFiles.addAll(introspectedTable .getGeneratedJavaFiles()); generatedXmlFiles.addAll(introspectedTable