使用mybatis generator生成java代码报错

org.mybatis.generator.plugins.comment.MyCommentGenerator.addModelClassComment(Lorg/mybatis/generator/api/dom/java/TopLevelClass;Lorg/mybatis/generator/api/IntrospectedTable;)V

2个回答

大多数情况还是自己写,因为这个太鸡肋

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 生成 命令 mybatis-generator:generate -->
<!-- Mybatis自动生成domin,dao,mapper -->
<generatorConfiguration>
    <properties resource="application.yml" />

    <context id="Mysql" targetRuntime="MyBatis3Simple"
        defaultModelType="flat">
        <property name="beginningDelimiter" value="`" />
        <property name="endingDelimiter" value="`" />
        <!-- <plugin type="tk.mybatis.mapper.generator.MapperPlugin"> <property 
            name="mappers" value="org.kd.common.base.BaseMapper"/> </plugin> -->

        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
            connectionURL="jdbc:mysql://localhost:3306/xxx" userId="root"
            password="xxxx">
        </jdbcConnection>

        <javaModelGenerator targetPackage="com.domain"
            targetProject="src/main/java" />

        <sqlMapGenerator targetPackage="com.dao.mapper"
            targetProject="src/main/java" />

        <javaClientGenerator targetPackage="com.dao"
            targetProject="src/main/java" type="XMLMAPPER" />


        <table tableName="t_user" domainObjectName="User"
            mapperName="UserMapper">
            <!--mysql 配置 -->
            <generatedKey column="id" sqlStatement="Mysql" identity="true" />
            <!--oracle 配置 -->
            <!--<generatedKey column="id" sqlStatement="select SEQ_{1}.nextval from 
                dual" identity="false" type="pre"/> -->
        </table>
    </context>
</generatorConfiguration>
#application.ym
spring:
  datasource:
    driverClassName: com.mysql.jdbc.Driver
    url : jdbc:mysql://localhost:3306/xxxx?useUnicode=true&characterEncoding=utf-8&useSSL=false 
    username : root
    password : xxxx
    type: com.alibaba.druid.pool.DruidDataSource

  mvc:
    view: 
      prefix: /WEB-INF/jsp/
      suffix: .jsp

# Mybatis配置
mybatis:
  typeAliasesPackage: com.domain
  mapperLocations: classpath:com/dao/mapper/*.xml
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问