MyBatis-Plus 配置

配置

  • springBoot工程
    • 配置 MapperScan 注解
@SpringBootApplication
@MapperScan("mapper文件位置")
public class Application {
   

    public static void main(String[] args) {
   
        SpringApplication.run(QuickStartApplication.class, args);
    }
}

一般来说,简单工程通过以上配置就可以正常使用MyBatis-Plus了
时 MyBatis-Plus 提供了大量的个性化配置来满足不同复杂度的工程,可以按照项目需求使用

基本配置

configLocation
  • 类型 string
  • 默认值 null
    MyBatis 配置文件位置,如果您有单独的 MyBatis 配置,请将其路径配置到 configLocation 中
mybatis-plus:
  mapper-locations: classpath*:mybatis/*.xml
typeAliasesPackage
  • 类型 string
  • 默认值 null
    MyBaits 别名包扫描路径,通过该属性可以给包中的类注册别名,注册后在 Mapper 对应的 XML 文件中可以直接使用类名,而不用使用全限定的类名(即 XML 中调用的时候不用包含包名)。
mybatis-plus:
  type-aliases-package: com.baomidou.mybatisplus.samples.quickstart.entity
typeAliasesSuperType
  • 类型 string
  • 默认值 null
    该配置请和 typeAliasesPackage 一起使用,如果配置了该属性,则仅仅会扫描路径下以该类作为父类的域对象 。
mybatis-plus:
  type-aliases-package: com.baomidou.mybatisplus.samples.quickstart.entity
  type-aliases-super-type: java.lang.Object
typeHandlersPackage
  • 类型 string
  • 默认值 null
    TypeHandler 扫描路径,如果配置了该属性,SqlSessionFactoryBean 会把该包下面的类注册为对应的 TypeHandler。
mybatis-plus:
  
  • 4
    点赞
  • 47
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值