mybatis配置环境流程

mybatis配置环境流程

为啥要用mybatis:通过Mybatis实现快速访问后端pgsql、mysql等数据库。

1.修改pom.xml,添加mybatis相关依赖

<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>1.3.2</version>
</dependency>
<dependency>
   <groupId>org.postgresql</groupId>
   <artifactId>postgresql</artifactId>
</dependency>

2.修改application.yml,修改数据库连接信息

这个application.yml我没有,所以我要在resources这个文件夹目录新建一个。建完之后放入这个代码。注意:配置url,username和password三个参数,依据自己pgsql的环境

spring:
  application:
    name: spring-boot-tutorial
  datasource:
    driverClassName: org.postgresql.Driver
    url: jdbc:postgresql://127.0.0.1:5432/tvseries?stringtype=unspecified&ApplicationName=tutorial
    username: postgres
    password: 123456
  jackson:
    serialization:
      write-dates-as-timestamps: true  #使用数值timestamp表示日期
 
mybatis.configuration.mapUnderscoreToCamelCase: true

这样下来mybatis应该算是配置好了,不过应该测试一下,不过我还没学测试,所以先掠过。

相关推荐

  1. mybatis配置环境流程

    2024-06-07 11:12:06       29 阅读
  2. 1. Spring Boot 自动配置 Mybatis 流程

    2024-06-07 11:12:06       60 阅读
  3. harmonyOS app 开发环境配置流程

    2024-06-07 11:12:06       50 阅读
  4. Mybatis配置

    2024-06-07 11:12:06       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-07 11:12:06       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-07 11:12:06       100 阅读
  3. 在Django里面运行非项目文件

    2024-06-07 11:12:06       82 阅读
  4. Python语言-面向对象

    2024-06-07 11:12:06       91 阅读

热门阅读

  1. RTLD_LAZY需要include哪个库

    2024-06-07 11:12:06       27 阅读
  2. elementUI输入框/选项卡与百度地图联动

    2024-06-07 11:12:06       35 阅读
  3. 堆(Heap)和栈(Stack)

    2024-06-07 11:12:06       29 阅读
  4. Python 脚本打包

    2024-06-07 11:12:06       27 阅读
  5. 二叉树的镜像--c++【做题记录】

    2024-06-07 11:12:06       35 阅读
  6. 使用C++版本的opencv dnn 部署onnx模型

    2024-06-07 11:12:06       31 阅读
  7. 【OpenCV 基础知识 21】霍夫变换圆形检测

    2024-06-07 11:12:06       28 阅读