springboot application.properties


Q:在整合其他框架时(如mybatis),springboot 的application.properties 怎样配置或者引入其他框架的配置文件。

Q:application.properties里面常用的配置属性有哪些?

springboot整合mybatis

springboot没有提供mybatis集成的官方支持,但是mybatis社区自己为mybatis搞了个starter(mybatis-spring-boot-starter)。这就是为什么application.properties里面没有关于mybatis的配置项,而我们可以在application.properties里面写

mybatis.config = mybatis config file name 
mybatis.mapperLocations = mappers file locations 
mybatis.typeAliasesPackage = domain object's package 
mybatis.typeHandlersPackage = handler's package 
mybatis.check-config-location = check the mybatis configuration exists 
mybatis.executorType = mode of execution. Default is SIMPLE

的原因。

SpringBoot doesn’t provide official support for MyBatis integration, but the MyBatis community built a SpringBoot starter for MyBatis.

springboot可以配置开发(dev)和生成(product)环境的配置文件如(application-dev.properties\application-prod.properties)。然后启动springboot的jar包时,使用在这里插入图片描述
指定配置文件就行。默认使用的是application.properties。

application.properties里面常用的配置属性有哪些

Spring Boot - Application Properties

总结

所以,springboot整合其他框架的关键在于,是否提供相应的xx-spring-boot-starter。(xx就可以从application.xml里面读取配置项了)

参考文献

Spring Boot - Application Properties

Appendix A. Common application properties

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值