Springboot整合Mysql集群

文章目录

  • 一、方法一
    • 1.1 默认配置
    • 1.2 需要自定义配置
    • 1.3 自定义数据库配置类
    • 1.4对从库进行操作(在写一个配置类)

一、方法一

1.1 默认配置

Springboot整合Mysql集群_第1张图片

1.2 需要自定义配置

Springboot整合Mysql集群_第2张图片

1.3 自定义数据库配置类

第一步:添加连接池驱动
Springboot整合Mysql集群_第3张图片
第二步:书写配置类
Springboot整合Mysql集群_第4张图片
Springboot整合Mysql集群_第5张图片
Springboot整合Mysql集群_第6张图片
在这里插入图片描述
Springboot整合Mysql集群_第7张图片

1.4对从库进行操作(在写一个配置类)

Springboot整合Mysql集群_第8张图片
Springboot整合Mysql集群_第9张图片
Springboot整合Mysql集群_第10张图片

你可能感兴趣的:(Mysql集群,spring,boot,mysql,后端)