Ver código fonte

更新代码生成器日志.

聂秋荣 1 mês atrás
pai
commit
616f5b3ae7
17 arquivos alterados com 37 adições e 53 exclusões
  1. 2 2
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/AutoGenerator.java
  2. 2 2
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/DataSourceConfig.java
  3. 2 2
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/StrategyConfig.java
  4. 1 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/ConfigBuilder.java
  5. 0 5
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Controller.java
  6. 0 5
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Mapper.java
  7. 0 5
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Service.java
  8. 12 5
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/AbstractTemplateEngine.java
  9. 0 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/BeetlTemplateEngine.java
  10. 0 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/EnjoyTemplateEngine.java
  11. 0 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/FreemarkerTemplateEngine.java
  12. 0 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/VelocityTemplateEngine.java
  13. 9 9
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/jdbc/DatabaseMetaDataWrapper.java
  14. 1 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/AbstractDatabaseQuery.java
  15. 4 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/DefaultQuery.java
  16. 1 1
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/SQLQuery.java
  17. 3 10
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/util/ClassUtils.java

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/AutoGenerator.java

@@ -171,7 +171,7 @@ public class AutoGenerator {
      * @param templateEngine 模板引擎
      * @param templateEngine 模板引擎
      */
      */
     public void execute(AbstractTemplateEngine templateEngine) {
     public void execute(AbstractTemplateEngine templateEngine) {
-        logger.debug("==========================准备生成文件...==========================");
+        logger.debug("==========================Ready to generate the file...==========================");
         // 初始化配置
         // 初始化配置
         if (null == config) {
         if (null == config) {
             config = new ConfigBuilder(packageInfo, dataSource, strategy, template, globalConfig, injection);
             config = new ConfigBuilder(packageInfo, dataSource, strategy, template, globalConfig, injection);
@@ -183,7 +183,7 @@ public class AutoGenerator {
         templateEngine.setConfigBuilder(config);
         templateEngine.setConfigBuilder(config);
         // 模板引擎初始化执行文件输出
         // 模板引擎初始化执行文件输出
         templateEngine.init(config).batchOutput().open();
         templateEngine.init(config).batchOutput().open();
-        logger.debug("==========================文件生成完成!!!==========================");
+        logger.debug("==========================The file is generated!!!==========================");
     }
     }
 
 
     /**
     /**

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/DataSourceConfig.java

@@ -367,7 +367,7 @@ public class DataSourceConfig {
         public Builder(@NotNull String url, String username, String password) {
         public Builder(@NotNull String url, String username, String password) {
             this();
             this();
             if (StringUtils.isBlank(url)) {
             if (StringUtils.isBlank(url)) {
-                throw new RuntimeException("无法创建文件,请正确输入 url 配置信息!");
+                throw new IllegalArgumentException("`url` cannot be empty");
             }
             }
             this.dataSourceConfig.url = url;
             this.dataSourceConfig.url = url;
             this.dataSourceConfig.username = username;
             this.dataSourceConfig.username = username;
@@ -393,7 +393,7 @@ public class DataSourceConfig {
                 this.dataSourceConfig.connection = conn;
                 this.dataSourceConfig.connection = conn;
                 this.dataSourceConfig.username = conn.getMetaData().getUserName();
                 this.dataSourceConfig.username = conn.getMetaData().getUserName();
             } catch (SQLException ex) {
             } catch (SQLException ex) {
-                throw new RuntimeException("构建数据库配置对象失败!", ex);
+                throw new RuntimeException(ex);
             }
             }
         }
         }
 
 

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/StrategyConfig.java

@@ -267,10 +267,10 @@ public class StrategyConfig {
         boolean isInclude = !this.getInclude().isEmpty();
         boolean isInclude = !this.getInclude().isEmpty();
         boolean isExclude = !this.getExclude().isEmpty();
         boolean isExclude = !this.getExclude().isEmpty();
         if (isInclude && isExclude) {
         if (isInclude && isExclude) {
-            throw new IllegalArgumentException("<strategy> 标签中 <include> 与 <exclude> 只能配置一项!");
+            throw new IllegalArgumentException("`include` and `exclude` configurations are mutually exclusive and cannot be used simultaneously.");
         }
         }
         if (this.getNotLikeTable() != null && this.getLikeTable() != null) {
         if (this.getNotLikeTable() != null && this.getLikeTable() != null) {
-            throw new IllegalArgumentException("<strategy> 标签中 <likeTable> 与 <notLikeTable> 只能配置一项!");
+            throw new IllegalArgumentException("`likeTable` and `notLikeTable` configurations are mutually exclusive and cannot be used simultaneously.");
         }
         }
     }
     }
 
 

+ 1 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/ConfigBuilder.java

@@ -121,7 +121,7 @@ public class ConfigBuilder {
             Constructor<? extends IDatabaseQuery> declaredConstructor = databaseQueryClass.getDeclaredConstructor(this.getClass());
             Constructor<? extends IDatabaseQuery> declaredConstructor = databaseQueryClass.getDeclaredConstructor(this.getClass());
             this.databaseQuery = declaredConstructor.newInstance(this);
             this.databaseQuery = declaredConstructor.newInstance(this);
         } catch (ReflectiveOperationException exception) {
         } catch (ReflectiveOperationException exception) {
-            throw new RuntimeException("创建IDatabaseQuery实例出现错误:", exception);
+            throw new RuntimeException(exception);
         }
         }
     }
     }
 
 

+ 0 - 5
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Controller.java

@@ -25,8 +25,6 @@ import com.baomidou.mybatisplus.generator.util.ClassUtils;
 import lombok.Getter;
 import lombok.Getter;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
@@ -39,8 +37,6 @@ import java.util.Map;
  */
  */
 public class Controller implements ITemplate {
 public class Controller implements ITemplate {
 
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(Controller.class);
-
     private Controller() {
     private Controller() {
     }
     }
 
 
@@ -200,7 +196,6 @@ public class Controller implements ITemplate {
          */
          */
         @Deprecated
         @Deprecated
         public Builder fileOverride() {
         public Builder fileOverride() {
-            LOGGER.warn("fileOverride方法后续会删除,替代方法为enableFileOverride方法");
             this.controller.fileOverride = true;
             this.controller.fileOverride = true;
             return this;
             return this;
         }
         }

+ 0 - 5
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Mapper.java

@@ -30,8 +30,6 @@ import lombok.Getter;
 import org.apache.ibatis.cache.Cache;
 import org.apache.ibatis.cache.Cache;
 import org.apache.ibatis.cache.decorators.LoggingCache;
 import org.apache.ibatis.cache.decorators.LoggingCache;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.Annotation;
 import java.util.Collections;
 import java.util.Collections;
@@ -51,8 +49,6 @@ import java.util.stream.Collectors;
  */
  */
 public class Mapper implements ITemplate {
 public class Mapper implements ITemplate {
 
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(Mapper.class);
-
     private Mapper() {
     private Mapper() {
     }
     }
 
 
@@ -374,7 +370,6 @@ public class Mapper implements ITemplate {
          */
          */
         @Deprecated
         @Deprecated
         public Builder fileOverride() {
         public Builder fileOverride() {
-            LOGGER.warn("fileOverride方法后续会删除,替代方法为enableFileOverride方法");
             this.mapper.fileOverride = true;
             this.mapper.fileOverride = true;
             return this;
             return this;
         }
         }

+ 0 - 5
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/Service.java

@@ -23,8 +23,6 @@ import com.baomidou.mybatisplus.generator.function.ConverterFileName;
 import com.baomidou.mybatisplus.generator.util.ClassUtils;
 import com.baomidou.mybatisplus.generator.util.ClassUtils;
 import lombok.Getter;
 import lombok.Getter;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
@@ -37,8 +35,6 @@ import java.util.Map;
  */
  */
 public class Service implements ITemplate {
 public class Service implements ITemplate {
 
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(Service.class);
-
     private Service() {
     private Service() {
     }
     }
 
 
@@ -239,7 +235,6 @@ public class Service implements ITemplate {
          */
          */
         @Deprecated
         @Deprecated
         public Builder fileOverride() {
         public Builder fileOverride() {
-            LOGGER.warn("fileOverride方法后续会删除,替代方法为enableFileOverride方法");
             this.service.fileOverride = true;
             this.service.fileOverride = true;
             return this;
             return this;
         }
         }

+ 12 - 5
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/AbstractTemplateEngine.java

@@ -186,6 +186,7 @@ public abstract class AbstractTemplateEngine {
                     File parentFile = file.getParentFile();
                     File parentFile = file.getParentFile();
                     FileUtils.forceMkdir(parentFile);
                     FileUtils.forceMkdir(parentFile);
                 }
                 }
+                LOGGER.debug("templatePath:{};  file:{}", templatePath, file);
                 writer(objectMap, templatePath, file);
                 writer(objectMap, templatePath, file);
             } catch (Exception exception) {
             } catch (Exception exception) {
                 throw new RuntimeException(exception);
                 throw new RuntimeException(exception);
@@ -249,7 +250,7 @@ public abstract class AbstractTemplateEngine {
                 outputController(tableInfo, objectMap);
                 outputController(tableInfo, objectMap);
             });
             });
         } catch (Exception e) {
         } catch (Exception e) {
-            throw new RuntimeException("无法创建文件,请检查配置信息!", e);
+            throw new RuntimeException("An exception occurred in the output file: ", e);
         }
         }
         return this;
         return this;
     }
     }
@@ -280,9 +281,15 @@ public abstract class AbstractTemplateEngine {
      */
      */
     public void open() {
     public void open() {
         String outDir = getConfigBuilder().getGlobalConfig().getOutputDir();
         String outDir = getConfigBuilder().getGlobalConfig().getOutputDir();
-        if (StringUtils.isBlank(outDir) || !new File(outDir).exists()) {
-            System.err.println("未找到输出目录:" + outDir);
-        } else if (getConfigBuilder().getGlobalConfig().isOpen()) {
+        if(StringUtils.isBlank(outDir)){
+            LOGGER.warn("The output directory is not configured");
+            return;
+        }
+        if(!new File(outDir).exists()){
+            LOGGER.warn("The output directory [{}] does not exist", outDir);
+            return;
+        }
+        if (getConfigBuilder().getGlobalConfig().isOpen()) {
             try {
             try {
                 RuntimeUtils.openDir(outDir);
                 RuntimeUtils.openDir(outDir);
             } catch (IOException e) {
             } catch (IOException e) {
@@ -354,7 +361,7 @@ public abstract class AbstractTemplateEngine {
      */
      */
     protected boolean isCreate(@NotNull File file, boolean fileOverride) {
     protected boolean isCreate(@NotNull File file, boolean fileOverride) {
         if (file.exists() && !fileOverride) {
         if (file.exists() && !fileOverride) {
-            LOGGER.warn("文件[{}]已存在,且未开启文件覆盖配置,需要开启配置可到策略配置中设置!!!", file.getName());
+            LOGGER.warn("File [{}] already exists. Overwrite mode is disabled. Enable this feature in the policy settings", file.getName());
         }
         }
         return !file.exists() || fileOverride;
         return !file.exists() || fileOverride;
     }
     }

+ 0 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/BeetlTemplateEngine.java

@@ -59,7 +59,6 @@ public class BeetlTemplateEngine extends AbstractTemplateEngine {
             Configuration cfg = Configuration.defaultConfiguration();
             Configuration cfg = Configuration.defaultConfiguration();
             groupTemplate = new GroupTemplate(new ClasspathResourceLoader("/"), cfg);
             groupTemplate = new GroupTemplate(new ClasspathResourceLoader("/"), cfg);
         } catch (IOException e) {
         } catch (IOException e) {
-            LOGGER.error("初始化模板引擎失败:", e);
             throw new RuntimeException(e);
             throw new RuntimeException(e);
         }
         }
         return this;
         return this;

+ 0 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/EnjoyTemplateEngine.java

@@ -58,7 +58,6 @@ public class EnjoyTemplateEngine extends AbstractTemplateEngine {
              BufferedWriter writer = new BufferedWriter(ow)) {
              BufferedWriter writer = new BufferedWriter(ow)) {
             writer.append(str);
             writer.append(str);
         }
         }
-        LOGGER.debug("模板:{};  文件:{}", templatePath, outputFile);
     }
     }
 
 
     @Override
     @Override

+ 0 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/FreemarkerTemplateEngine.java

@@ -59,7 +59,6 @@ public class FreemarkerTemplateEngine extends AbstractTemplateEngine {
         try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
         try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
             template.process(objectMap, new OutputStreamWriter(fileOutputStream, ConstVal.UTF8));
             template.process(objectMap, new OutputStreamWriter(fileOutputStream, ConstVal.UTF8));
         }
         }
-        LOGGER.debug("模板:{};  文件:{}", templatePath, outputFile);
     }
     }
 
 
 
 

+ 0 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/VelocityTemplateEngine.java

@@ -82,7 +82,6 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
              BufferedWriter writer = new BufferedWriter(ow)) {
              BufferedWriter writer = new BufferedWriter(ow)) {
             template.merge(new VelocityContext(objectMap), writer);
             template.merge(new VelocityContext(objectMap), writer);
         }
         }
-        LOGGER.debug("模板:{};  文件:{}", templatePath, outputFile);
     }
     }
 
 
 
 

+ 9 - 9
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/jdbc/DatabaseMetaDataWrapper.java

@@ -54,14 +54,14 @@ public class DatabaseMetaDataWrapper {
     public DatabaseMetaDataWrapper(Connection connection, String schemaName) {
     public DatabaseMetaDataWrapper(Connection connection, String schemaName) {
         try {
         try {
             if (null == connection) {
             if (null == connection) {
-                throw new RuntimeException("数据库连接不能为空");
+                throw new RuntimeException("connection cannot be null");
             }
             }
             this.connection = connection;
             this.connection = connection;
             this.databaseMetaData = connection.getMetaData();
             this.databaseMetaData = connection.getMetaData();
             this.catalog = connection.getCatalog();
             this.catalog = connection.getCatalog();
             this.schema = schemaName;
             this.schema = schemaName;
         } catch (SQLException e) {
         } catch (SQLException e) {
-            throw new RuntimeException("获取元数据错误:", e);
+            throw new RuntimeException(e);
         }
         }
     }
     }
 
 
@@ -70,7 +70,7 @@ public class DatabaseMetaDataWrapper {
             try {
             try {
                 con.close();
                 con.close();
             } catch (SQLException sqlException) {
             } catch (SQLException sqlException) {
-                logger.error("关闭数据库连接出现错误:", sqlException);
+                logger.error("close connection exception:", sqlException);
             }
             }
         });
         });
     }
     }
@@ -93,7 +93,7 @@ public class DatabaseMetaDataWrapper {
                 }
                 }
             }
             }
         } catch (SQLException e) {
         } catch (SQLException e) {
-            logger.error("读取{}索引信息出现错误:", tableName, e);
+            logger.error("reading index information for [{}]:", tableName, e);
         }
         }
         return indexList;
         return indexList;
     }
     }
@@ -112,10 +112,10 @@ public class DatabaseMetaDataWrapper {
                     primaryKeys.add(columnName);
                     primaryKeys.add(columnName);
                 }
                 }
                 if (primaryKeys.size() > 1) {
                 if (primaryKeys.size() > 1) {
-                    logger.warn("当前表:{},存在多主键情况!", tableName);
+                    logger.warn("The current table [{}] has multiple primary keys defined.", tableName);
                 }
                 }
             } catch (SQLException e) {
             } catch (SQLException e) {
-                throw new RuntimeException("读取表主键信息:" + tableName + "错误:", e);
+                throw new RuntimeException(e);
             }
             }
         }
         }
         Map<String, Column> columnsInfoMap = new LinkedHashMap<>();
         Map<String, Column> columnsInfoMap = new LinkedHashMap<>();
@@ -144,7 +144,7 @@ public class DatabaseMetaDataWrapper {
             }
             }
             return Collections.unmodifiableMap(columnsInfoMap);
             return Collections.unmodifiableMap(columnsInfoMap);
         } catch (SQLException e) {
         } catch (SQLException e) {
-            throw new RuntimeException("读取表字段信息:" + tableName + "错误:", e);
+            throw new RuntimeException(e);
         }
         }
     }
     }
 
 
@@ -181,7 +181,7 @@ public class DatabaseMetaDataWrapper {
                 tables.add(table);
                 tables.add(table);
             }
             }
         } catch (SQLException e) {
         } catch (SQLException e) {
-            throw new RuntimeException("读取数据库表信息出现错误", e);
+            throw new RuntimeException(e);
         }
         }
         return tables;
         return tables;
     }
     }
@@ -196,7 +196,7 @@ public class DatabaseMetaDataWrapper {
                 table.tableType = resultSet.getString("TABLE_TYPE");
                 table.tableType = resultSet.getString("TABLE_TYPE");
             }
             }
         } catch (SQLException e) {
         } catch (SQLException e) {
-            throw new RuntimeException("读取表信息:" + tableName + "错误:", e);
+            throw new RuntimeException(e);
         }
         }
         return table;
         return table;
     }
     }

+ 1 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/AbstractDatabaseQuery.java

@@ -83,7 +83,7 @@ public abstract class AbstractDatabaseQuery implements IDatabaseQuery {
                 notExistTables.remove(tabInfo.getName().toLowerCase());
                 notExistTables.remove(tabInfo.getName().toLowerCase());
             }
             }
             if (!notExistTables.isEmpty()) {
             if (!notExistTables.isEmpty()) {
-                LOGGER.warn("表[{}]在数据库中不存在!!!", String.join(StringPool.COMMA, notExistTables.values()));
+                LOGGER.warn("Table [{}] does not exist in the database!", String.join(StringPool.COMMA, notExistTables.values()));
             }
             }
             // 需要反向生成的表信息
             // 需要反向生成的表信息
             if (isExclude) {
             if (isExclude) {

+ 4 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/DefaultQuery.java

@@ -99,6 +99,9 @@ public class DefaultQuery extends AbstractDatabaseQuery {
         if (strategyConfig.getLikeTable() != null) {
         if (strategyConfig.getLikeTable() != null) {
             tableNamePattern = strategyConfig.getLikeTable().getValue();
             tableNamePattern = strategyConfig.getLikeTable().getValue();
         }
         }
+        if (strategyConfig.getNotLikeTable() != null) {
+            LOGGER.warn("Unsupported 'notLikeTable' configuration");
+        }
         return databaseMetaDataWrapper.getTables(tableNamePattern, skipView ? new String[]{"TABLE"} : new String[]{"TABLE", "VIEW"});
         return databaseMetaDataWrapper.getTables(tableNamePattern, skipView ? new String[]{"TABLE"} : new String[]{"TABLE", "VIEW"});
     }
     }
 
 
@@ -114,7 +117,7 @@ public class DefaultQuery extends AbstractDatabaseQuery {
                 field.primaryKey(columnInfo.isAutoIncrement());
                 field.primaryKey(columnInfo.isAutoIncrement());
                 tableInfo.setHavePrimaryKey(true);
                 tableInfo.setHavePrimaryKey(true);
                 if (field.isKeyIdentityFlag() && entity.getIdType() != null) {
                 if (field.isKeyIdentityFlag() && entity.getIdType() != null) {
-                    LOGGER.warn("当前表[{}]的主键为自增主键,会导致全局主键的ID类型设置失效!", tableName);
+                    LOGGER.warn("The primary key of the current table [{}] is configured as auto-incrementing, which will override the global primary key ID type strategy.", tableName);
                 }
                 }
             }
             }
             field.setColumnName(columnName).setComment(columnInfo.getRemarks());
             field.setColumnName(columnName).setComment(columnInfo.getRemarks());

+ 1 - 1
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/query/SQLQuery.java

@@ -120,7 +120,7 @@ public class SQLQuery extends AbstractDatabaseQuery {
                     field.primaryKey(dbQuery.isKeyIdentity(result.getResultSet()));
                     field.primaryKey(dbQuery.isKeyIdentity(result.getResultSet()));
                     tableInfo.setHavePrimaryKey(true);
                     tableInfo.setHavePrimaryKey(true);
                     if (field.isKeyIdentityFlag() && entity.getIdType() != null) {
                     if (field.isKeyIdentityFlag() && entity.getIdType() != null) {
-                        LOGGER.warn("当前表[{}]的主键为自增主键,会导致全局主键的ID类型设置失效!", tableName);
+                        LOGGER.warn("The primary key of the current table [{}] is configured as auto-incrementing, which will override the global primary key ID type strategy.", tableName);
                     }
                     }
                 }
                 }
                 // 处理ID
                 // 处理ID

+ 3 - 10
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/util/ClassUtils.java

@@ -15,7 +15,6 @@
  */
  */
 package com.baomidou.mybatisplus.generator.util;
 package com.baomidou.mybatisplus.generator.util;
 
 
-import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 
 
@@ -49,15 +48,7 @@ public final class ClassUtils {
      * @return 返回转换后的 Class
      * @return 返回转换后的 Class
      */
      */
     public static Class<?> toClassConfident(String name) {
     public static Class<?> toClassConfident(String name) {
-        try {
-            return Class.forName(name, false, getDefaultClassLoader());
-        } catch (ClassNotFoundException e) {
-            try {
-                return Class.forName(name);
-            } catch (ClassNotFoundException ex) {
-                throw ExceptionUtils.mpe("找不到指定的class!请仅在明确确定会有 class 的时候,调用该方法", e);
-            }
-        }
+        return com.baomidou.mybatisplus.core.toolkit.ClassUtils.toClassConfident(name);
     }
     }
 
 
     /**
     /**
@@ -75,7 +66,9 @@ public final class ClassUtils {
      * @see Thread#getContextClassLoader()
      * @see Thread#getContextClassLoader()
      * @see ClassLoader#getSystemClassLoader()
      * @see ClassLoader#getSystemClassLoader()
      * @since 3.3.2
      * @since 3.3.2
+     * @deprecated 3.5.13
      */
      */
+    @Deprecated
     public static ClassLoader getDefaultClassLoader() {
     public static ClassLoader getDefaultClassLoader() {
         ClassLoader cl = null;
         ClassLoader cl = null;
         try {
         try {