springboot学习--springboot+maven+mybatis项目搭建

今天我们来搭建一个简单的基于springboot+mybatis+maven的项目,使用的数据库为mysql。

 

最终项目目录结构

一、项目创建

1.新建spring项目

 

选择Spring Initializr,选择jdk版本,之后点击Next

填写Group,Artifact,Type选择Maven Project 点击Next

添加项目依赖,暂时只需添加Web,Mybatis,Mysql三个依赖,点击Next

选择项目路径,点击Finish,创建成功

之后在application.properties资源文件中添加mybatis配置信息,项目启动时会自动加载配置项

 

#mybatis
spring.datasource.url=jdbc:mysql://10.100.50.23/test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=root

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#mybatis.config-location=classpath:mybatis-config.xml
mybatis.typeAliasesPackage=com.example.entity
mybatis.mapper-locations=classpath:mapper/**/*.xml

 

 

2.目录结构简单介绍

 2.1 java

这个就不用

  • 4
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值