欢迎访问移动开发之家(rcyd.net),关注移动开发教程。移动开发之家  移动开发问答|  每日更新
页面位置 : > > 内容正文

Springboot:用mybatis-generator自动生成bean和dao,

来源: 开发者 投稿于  被查看 49891 次 评论:270

Springboot:用mybatis-generator自动生成bean和dao,


1、在pom.xml里添加maven插件

              
                org.mybatis.generator  
                mybatis-generator-maven-plugin  
                1.3.5  
                  
                      
                         mysql  
                         mysql-connector-java  
                         5.1.39  
                      
                      
                        org.mybatis.generator  
                        mybatis-generator-core  
                        1.3.5  
                      
                  
                  
                      
                        Generate MyBatis Artifacts  
                        package  
                          
                            generate  
                          
                      
                  
                  
                      
                    true  
                      
                    true  
                      
                      
                        src/main/resources/mybatis-generator.xml  
                  
              

2、在resources下创建mybatis-generator.xml

  
  
  

      
          
              
              
          
          
          
          
          
              
          
          
          
              
              
          
          
          
              
          
          
          
          
              
          
        

3、在src/main/java/com/demo/下创建dao、model、mapper文件夹。

4、在maven project下双击mybatis-generator插件下的mybatis-generator:generate

相关频道:

用户评论