SpringBoot+MyBatisPlus(1)—— 整合SpringBoot + MyBatisPlus +Thymeleaf环境

一. 添加依赖

1. 创建SpringBoot的web工程:https://blog.csdn.net/Archer__13/article/details/126806516

2. 添加依赖 

        <!-- mybatis-plus启动器 -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>
        <!-- lombok用于简化实体类开发 -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- mysql驱动 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>


        <!-- Thymeleaf -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

二. 配置application.yml文件

server:
  port: 8080  #设置端口号
  servlet:
    context-path: /    #设置访问应用的上下文路径

spring:
  datasource:    #配置连接数据库的信息
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
    username: root
    password: 123456
  thymeleaf:    #配置thymeleaf模板
    cache: false        #在开发阶段,关闭模板引擎
    encoding: UTF-8     #编码格式
    mode: HTML          #模板的类型(默认是HTML)
    prefix: classpath:/templates/    #模板前缀:文件的路径
    suffix: .html       #模板后缀
  mvc:
    static-path-pattern: /static/**    #配置静态资源路径

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl    #添加日志
    map-underscore-to-camel-case: true   #在映射实体或属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值