将tk.mybatis工程改成tk.mapper+mybatis plus 用于renren generator

为了方便前端快速开发,使用renren fast快速生成代码减少前端工作量。
人人快速框架是单体的架构,我的工程是微服务架构,人人是基于mybatis plus生成后台代码的,我原来的工程是使用tk.mybatis,我需要原来基于tk.mybatis生成的代码能使用,又能使用mybatis plus生成的代码,所以采用了tk.mapper+mybatis plus来集成。
将tk.mybatis工程改成tk.mapper+mybatis plus 用于renren generator。

本文只作为我自己个人记录,或给大家参考,因为在过程中有很多坑,但因为个人年龄比较大,记不得很多了。

1、过程中将spring boot和cloud升级了版本

org.springframework.boot
spring-boot-starter-parent
2.1.12.RELEASE


Greenwich.RELEASE

2、因为兼容性问题,修改了服务的组件很多版本。直接上pom

    
        org.mybatis.generator
        mybatis-generator-core
        1.3.6
    


    
        tk.mybatis
        mapper
        4.0.0
    

    
    
        org.mybatis
        mybatis
        3.5.3
    

    
        com.baomidou
        mybatis-plus-boot-starter
        ${mybatisplus.version}
        
            
                com.baomidou
                mybatis-plus-generator
            
        
    

    
    
        com.baomidou
        mybatis-plus-extension
        3.3.1
        
            
                mybatis
                org.mybatis
            
        
    



    
    
        com.github.pagehelper
        pagehelper
        5.1.11
    

因为时间关系,发文时还没有把这些整到所有的服务的通用模块中,只单独放在两个服务中,合入renren生成的后端mapper、dao、service、controller,调用正常。

记得的两个小坑:
1、需要修改property setting spring.main.allow-bean-definition-overriding=true
2020-05-06 22:17:04,878 INFO (SpringApplication.java:652)- The following profiles are active: dev
2020-05-06 22:17:05,515 WARN (AbstractApplicationContext.java:557)- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name ‘service-goods.FeignClientSpecification’ defined in null: Cannot register bean definition [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean ‘service-goods.FeignClientSpecification’: There is already [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] bound.

2、启动增加包@MapperScan(basePackages = {“com.xx.busi.mappers”,“com.xx.busi.dao”})

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.xx.busi.dao.BuBusiSupplierTDao’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

你可能感兴趣的:(组件集成)