diff --git a/pom.xml b/pom.xml index 9acfb63..a68dba9 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ 1.8 + 5.1.47 @@ -45,6 +46,18 @@ test + + com.alibaba + druid-spring-boot-starter + 1.1.9 + + + + mysql + mysql-connector-java + ${mysql-connector.version} + + org.apache.commons diff --git a/src/main/java/net/educoder/ecsonar/config/DynamicDataSource.java b/src/main/java/net/educoder/ecsonar/config/DynamicDataSource.java new file mode 100644 index 0000000..f944231 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/config/DynamicDataSource.java @@ -0,0 +1,15 @@ +package net.educoder.ecsonar.config; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * @Author: youys + * @Date: 2021/12/31 + * @Description: + */ +public class DynamicDataSource extends AbstractRoutingDataSource { + @Override + protected Object determineCurrentLookupKey() { + return DynamicDataSourceContextHolder.getContextKey(); + } +} diff --git a/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceConfig.java b/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceConfig.java new file mode 100644 index 0000000..d8bb9cf --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceConfig.java @@ -0,0 +1,97 @@ +package net.educoder.ecsonar.config; + +import com.alibaba.druid.pool.DruidDataSource; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.sql.DataSource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: youys + * @Date: 2021/12/31 + * @Description: + */ + +@Configuration +@MapperScan(basePackages = "net.educoder.ecsonar.dao") +public class DynamicDataSourceConfig { + + public static final String MASTER = "master"; + public static final String READONLY = "readonly"; + + private static final List INIT_SQLS= Arrays.asList("SET NAMES utf8mb4"); + + @Value("${spring.datasource.master.driverClassName}") + private String masterDriverClass; + + @Value("${spring.datasource.master.url}") + private String masterUrl; + + @Value("${spring.datasource.master.username}") + private String masterUsername; + + @Value("${spring.datasource.master.password}") + private String masterPassword; + + @Value("${spring.datasource.readonly.driverClassName}") + private String readonlyDriverClass; + + @Value("${spring.datasource.readonly.url}") + private String readonlyUrl; + + @Value("${spring.datasource.readonly.username}") + private String readonlyUsername; + + @Value("${spring.datasource.readonly.password}") + private String readonlyPassword; + + @Value("${spring.datasource.initSize}") + private Integer initSize; + + @Bean("master") + public DataSource masterDataSource() { + DruidDataSource masterDataSource = new DruidDataSource(); + masterDataSource.setDriverClassName(masterDriverClass); + masterDataSource.setUrl(masterUrl); + masterDataSource.setUsername(masterUsername); + masterDataSource.setPassword(masterPassword); + masterDataSource.setInitialSize(initSize); + masterDataSource.setConnectionInitSqls(INIT_SQLS); + return masterDataSource; + } + + @Bean("readonly") + public DataSource slaveDataSource() { + DruidDataSource readonlyDataSource = new DruidDataSource(); + readonlyDataSource.setDriverClassName(readonlyDriverClass); + readonlyDataSource.setUrl(readonlyUrl); + readonlyDataSource.setUsername(readonlyUsername); + readonlyDataSource.setPassword(readonlyPassword); + readonlyDataSource.setInitialSize(initSize); + readonlyDataSource.setConnectionInitSqls(INIT_SQLS); + return readonlyDataSource; + } + + + @Bean + @Primary + public DataSource dynamicDataSource() { + Map dataSourceMap = new HashMap<>(2); + dataSourceMap.put(MASTER, masterDataSource()); + dataSourceMap.put(READONLY, slaveDataSource()); + //设置动态数据源 + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + dynamicDataSource.setTargetDataSources(dataSourceMap); + dynamicDataSource.setDefaultTargetDataSource(masterDataSource()); + + return dynamicDataSource; + } + +} diff --git a/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceContextHolder.java b/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..0bd14eb --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/config/DynamicDataSourceContextHolder.java @@ -0,0 +1,35 @@ +package net.educoder.ecsonar.config; + +/** + * @Author: youys + * @Date: 2021/12/31 + * @Description: + */ +public class DynamicDataSourceContextHolder { + + /** + * 动态数据源名称上下文 + */ + private static final ThreadLocal DATASOURCE_CONTEXT_KEY_HOLDER = new ThreadLocal<>(); + /** + * 设置/切换数据源 + */ + public static void setContextKey(String key){ + DATASOURCE_CONTEXT_KEY_HOLDER.set(key); + } + /** + * 获取数据源名称 + */ + public static String getContextKey(){ + String key = DATASOURCE_CONTEXT_KEY_HOLDER.get(); + return key == null? net.educode.detection.config.DynamicDataSourceConfig.MASTER: key; + } + + /** + * 删除当前数据源名称 + */ + public static void removeContextKey(){ + DATASOURCE_CONTEXT_KEY_HOLDER.remove(); + } + +} diff --git a/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java b/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java new file mode 100644 index 0000000..e6635fa --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java @@ -0,0 +1,62 @@ +package net.educoder.ecsonar.controller; + +import net.educoder.ecsonar.model.api.QualityInspectIsCompleted; +import net.educoder.ecsonar.model.api.QualityInspectResult; +import net.educoder.ecsonar.model.vo.QualityInspectVO; +import net.educoder.ecsonar.services.QualityInspectService; +import net.educoder.ecsonar.utils.ResponseResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +@RestController +@RequestMapping("/api") +public class QualityInspectController { + + @Autowired + QualityInspectService qualityInspectService; + + + /** + * 质量检测 + * @param qualityInspectVO + * @return + */ + @RequestMapping(value = "qualityInspect", method = RequestMethod.POST) + public ResponseResult qualityInspect(@RequestBody QualityInspectVO qualityInspectVO){ + String taskId = qualityInspectService.qualityInspect(qualityInspectVO); + return ResponseResult.success(taskId); + } + + + /** + * 质量检测任务是否完成 + * @param taskId + * @return + */ + @RequestMapping(value = "qualityInspectIsCompleted", method = RequestMethod.GET) + public ResponseResult qualityInspectIsCompleted(@RequestParam String taskId){ + QualityInspectIsCompleted result = qualityInspectService.qualityInspectIsCompleted(taskId); + return ResponseResult.success(result); + } + + + /** + * 质量检测结果查询 + * @param taskId + * @return + */ + @RequestMapping(value = "qualityInspectResultQuery", method = RequestMethod.GET) + public ResponseResult qualityInspectResultQuery(@RequestParam String taskId){ + QualityInspectResult result = qualityInspectService.qualityInspectResultQuery(taskId); + return ResponseResult.success(result); + } + +} + + + diff --git a/src/main/java/net/educoder/ecsonar/model/api/Quality.java b/src/main/java/net/educoder/ecsonar/model/api/Quality.java new file mode 100644 index 0000000..e670ae2 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/api/Quality.java @@ -0,0 +1,70 @@ +package net.educoder.ecsonar.model.api; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: 质量 + */ +public class Quality { + + /** + * 阻断 + */ + private Integer blocker; + /** + * 主要 + */ + private Integer major; + /** + * 次要 + */ + private Integer minor; + /** + * 严重 + */ + private Integer critical; + /** + * 等级 A-E + */ + private String grade; + + public Integer getBlocker() { + return blocker; + } + + public void setBlocker(Integer blocker) { + this.blocker = blocker; + } + + public Integer getMajor() { + return major; + } + + public void setMajor(Integer major) { + this.major = major; + } + + public Integer getMinor() { + return minor; + } + + public void setMinor(Integer minor) { + this.minor = minor; + } + + public Integer getCritical() { + return critical; + } + + public void setCritical(Integer critical) { + this.critical = critical; + } + + public String getGrade() { + return grade; + } + + public void setGrade(String grade) { + this.grade = grade; + } +} diff --git a/src/main/java/net/educoder/ecsonar/model/api/QualityInspectIsCompleted.java b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectIsCompleted.java new file mode 100644 index 0000000..e9d4c36 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectIsCompleted.java @@ -0,0 +1,41 @@ +package net.educoder.ecsonar.model.api; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +public class QualityInspectIsCompleted { + + /** + * 任务id + */ + private String taskId; + + + /** + * 是否完成 0 未完成 1 已完成 + */ + private Integer completed; + + public QualityInspectIsCompleted(String taskId, Integer completed) { + this.taskId = taskId; + this.completed = completed; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public Integer getCompleted() { + return completed; + } + + public void setCompleted(Integer completed) { + this.completed = completed; + } +} diff --git a/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResult.java b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResult.java new file mode 100644 index 0000000..f9d44f9 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResult.java @@ -0,0 +1,42 @@ +package net.educoder.ecsonar.model.api; + +import java.util.List; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: 检测结果 + */ +public class QualityInspectResult { + + /** + * 任务id + */ + private String taskId; + + + /** + * 质量检测数据 + */ + private List dataList; + + + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + + + public List getDataList() { + return dataList; + } + + public void setDataList(List dataList) { + this.dataList = dataList; + } +} diff --git a/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResultData.java b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResultData.java new file mode 100644 index 0000000..b9ad64f --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/api/QualityInspectResultData.java @@ -0,0 +1,125 @@ +package net.educoder.ecsonar.model.api; + +import java.math.BigDecimal; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +public class QualityInspectResultData { + + /** + * 导师 + */ + private String mentor; + /** + * 学号 + */ + private String studentId; + + /** + * 姓名 + */ + private String name; + + /** + * 缺陷 + */ + private Quality bug; + /** + * 漏洞 + */ + private Quality vulnerability; + /** + * 代码规范 + */ + private Quality codeSmall; + + /** + * 复杂度 + */ + private BigDecimal complexity; + + /** + * 总行数 + */ + private Integer totalRowNumber; + + /** + * 质量得分 + */ + private BigDecimal qualityScore; + + public String getMentor() { + return mentor; + } + + public void setMentor(String mentor) { + this.mentor = mentor; + } + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Quality getBug() { + return bug; + } + + public void setBug(Quality bug) { + this.bug = bug; + } + + public Quality getVulnerability() { + return vulnerability; + } + + public void setVulnerability(Quality vulnerability) { + this.vulnerability = vulnerability; + } + + public Quality getCodeSmall() { + return codeSmall; + } + + public void setCodeSmall(Quality codeSmall) { + this.codeSmall = codeSmall; + } + + public BigDecimal getComplexity() { + return complexity; + } + + public void setComplexity(BigDecimal complexity) { + this.complexity = complexity; + } + + public Integer getTotalRowNumber() { + return totalRowNumber; + } + + public void setTotalRowNumber(Integer totalRowNumber) { + this.totalRowNumber = totalRowNumber; + } + + public BigDecimal getQualityScore() { + return qualityScore; + } + + public void setQualityScore(BigDecimal qualityScore) { + this.qualityScore = qualityScore; + } +} diff --git a/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectUserDataVO.java b/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectUserDataVO.java new file mode 100644 index 0000000..67bc36f --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectUserDataVO.java @@ -0,0 +1,49 @@ +package net.educoder.ecsonar.model.vo; + +import java.util.List; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +public class QualityInspectUserDataVO { + + /** + * 学号 + */ + private String studentId; + /** + * 姓名 + */ + private String name; + + /** + * 学员代码id + */ + private List codeIds; + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getCodeIds() { + return codeIds; + } + + public void setCodeIds(List codeIds) { + this.codeIds = codeIds; + } +} diff --git a/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectVO.java b/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectVO.java new file mode 100644 index 0000000..c8f9866 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/model/vo/QualityInspectVO.java @@ -0,0 +1,40 @@ +package net.educoder.ecsonar.model.vo; + +import java.util.List; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +public class QualityInspectVO { + + private String language; + private String homeworkId; + private List userDatas; + + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getHomeworkId() { + return homeworkId; + } + + public void setHomeworkId(String homeworkId) { + this.homeworkId = homeworkId; + } + + public List getUserDatas() { + return userDatas; + } + + public void setUserDatas(List userDatas) { + this.userDatas = userDatas; + } +} diff --git a/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java b/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java new file mode 100644 index 0000000..8e7bffb --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java @@ -0,0 +1,37 @@ +package net.educoder.ecsonar.services; + +import net.educoder.ecsonar.model.api.QualityInspectIsCompleted; +import net.educoder.ecsonar.model.api.QualityInspectResult; +import net.educoder.ecsonar.model.vo.QualityInspectVO; +import org.springframework.stereotype.Service; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +@Service +public class QualityInspectService { + + + public String qualityInspect(QualityInspectVO qualityInspectVO) { + + + return null; + } + + + public QualityInspectResult qualityInspectResultQuery(String taskId) { + + QualityInspectResult result = new QualityInspectResult(); + + + return result; + } + + public QualityInspectIsCompleted qualityInspectIsCompleted(String taskId) { + QualityInspectIsCompleted completed = new QualityInspectIsCompleted(taskId, 1); + + return null; + } +} diff --git a/src/main/java/net/educoder/ecsonar/utils/IdUtils.java b/src/main/java/net/educoder/ecsonar/utils/IdUtils.java new file mode 100644 index 0000000..a1d9a12 --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/utils/IdUtils.java @@ -0,0 +1,15 @@ +package net.educoder.ecsonar.utils; + +public final class IdUtils { + + private static SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0); + + private IdUtils() { + + } + + public static long nextId() { + return idWorker.nextId(); + } + +} diff --git a/src/main/java/net/educoder/ecsonar/utils/ResponseResult.java b/src/main/java/net/educoder/ecsonar/utils/ResponseResult.java new file mode 100644 index 0000000..7ad3a2f --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/utils/ResponseResult.java @@ -0,0 +1,39 @@ +package net.educoder.ecsonar.utils; + +/** + * @Author: youys + * @Date: 2022/1/17 + * @Description: + */ +public class ResponseResult { + + private Integer code; + private String msg; + private T data; + + + public ResponseResult(){ + + } + public ResponseResult(Integer code, String msg){ + this.code = code; + this.msg = msg; + } + + public ResponseResult(T data){ + this.data = data; + } + + public static ResponseResult success(){ + return new ResponseResult(1,"success"); + } + + + public static ResponseResult success(Object data){ + return new ResponseResult(data); + } + + public static ResponseResult error(String msg){ + return new ResponseResult(2,msg); + } +} diff --git a/src/main/java/net/educoder/ecsonar/utils/SnowflakeIdWorker.java b/src/main/java/net/educoder/ecsonar/utils/SnowflakeIdWorker.java new file mode 100644 index 0000000..174e4eb --- /dev/null +++ b/src/main/java/net/educoder/ecsonar/utils/SnowflakeIdWorker.java @@ -0,0 +1,147 @@ +package net.educoder.ecsonar.utils; + +/** + * Twitter_Snowflake
+ * SnowFlake的结构如下(每部分用-分开):
+ * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - + * 000000000000
+ * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0
+ * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截) + * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T + * = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69
+ * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId
+ * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号
+ * 加起来刚好64位,为一个Long型。
+ * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。 + */ +public class SnowflakeIdWorker { + + // ==============================Fields=========================================== + /** 开始时间截 (2015-01-01) */ + private final long twepoch = 1420041600000L; + + /** 机器id所占的位数 */ + private final long workerIdBits = 5L; + + /** 数据标识id所占的位数 */ + private final long datacenterIdBits = 5L; + + /** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */ + private final long maxWorkerId = -1L ^ (-1L << workerIdBits); + + /** 支持的最大数据标识id,结果是31 */ + private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); + + /** 序列在id中占的位数 */ + private final long sequenceBits = 12L; + + /** 机器ID向左移12位 */ + private final long workerIdShift = sequenceBits; + + /** 数据标识id向左移17位(12+5) */ + private final long datacenterIdShift = sequenceBits + workerIdBits; + + /** 时间截向左移22位(5+5+12) */ + private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; + + /** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */ + private final long sequenceMask = -1L ^ (-1L << sequenceBits); + + /** 工作机器ID(0~31) */ + private long workerId; + + /** 数据中心ID(0~31) */ + private long datacenterId; + + /** 毫秒内序列(0~4095) */ + private long sequence = 0L; + + /** 上次生成ID的时间截 */ + private long lastTimestamp = -1L; + + // ==============================Constructors===================================== + /** + * 构造函数 + * + * @param workerId + * 工作ID (0~31) + * @param datacenterId + * 数据中心ID (0~31) + */ + public SnowflakeIdWorker(long workerId, long datacenterId) { + if (workerId > maxWorkerId || workerId < 0) { + throw new IllegalArgumentException( + String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); + } + if (datacenterId > maxDatacenterId || datacenterId < 0) { + throw new IllegalArgumentException( + String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); + } + this.workerId = workerId; + this.datacenterId = datacenterId; + } + + // ==============================Methods========================================== + /** + * 获得下一个ID (该方法是线程安全的) + * + * @return SnowflakeId + */ + public synchronized long nextId() { + long timestamp = timeGen(); + + // 如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 + if (timestamp < lastTimestamp) { + throw new RuntimeException(String.format( + "Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); + } + + // 如果是同一时间生成的,则进行毫秒内序列 + if (lastTimestamp == timestamp) { + sequence = (sequence + 1) & sequenceMask; + // 毫秒内序列溢出 + if (sequence == 0) { + // 阻塞到下一个毫秒,获得新的时间戳 + timestamp = tilNextMillis(lastTimestamp); + } + } + // 时间戳改变,毫秒内序列重置 + else { + sequence = 0L; + } + + // 上次生成ID的时间截 + lastTimestamp = timestamp; + + // 移位并通过或运算拼到一起组成64位的ID + return ((timestamp - twepoch) << timestampLeftShift) // + | (datacenterId << datacenterIdShift) // + | (workerId << workerIdShift) // + | sequence; + } + + /** + * 阻塞到下一个毫秒,直到获得新的时间戳 + * + * @param lastTimestamp + * 上次生成ID的时间截 + * @return 当前时间戳 + */ + protected long tilNextMillis(long lastTimestamp) { + long timestamp = timeGen(); + while (timestamp <= lastTimestamp) { + timestamp = timeGen(); + } + return timestamp; + } + + /** + * 返回以毫秒为单位的当前时间 + * + * @return 当前时间(毫秒) + */ + protected long timeGen() { + return System.currentTimeMillis(); + } + +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0b02acd..9042525 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,20 +1,32 @@ -spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/sonar7.7 +#spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/sonar7.7 +##spring.datasource.url=jdbc:postgresql://117.50.14.123:5432/sonar +#spring.datasource.username=root +#spring.datasource.password=root +#spring.datasource.driver-class-name=org.postgresql.Driver + + +spring.datasource.master.url=jdbc:postgresql://127.0.0.1:5432/sonar7.7 #spring.datasource.url=jdbc:postgresql://117.50.14.123:5432/sonar -spring.datasource.username=root -spring.datasource.password=root -spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.master.username=root +spring.datasource.master.password=root +spring.datasource.master.driverClass=org.postgresql.Driver + +spring.datasource.readonly.driverClassName=com.mysql.jdbc.Driver +spring.datasource.readonly.url=jdbc:mysql://rm-bp1ht3504joktie83.mysql.rds.aliyuncs.com:3306/educoderweb?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false +spring.datasource.readonly.username=readonly +spring.datasource.readonly.password=readonly_20210901 # Hikari will use the above plus the following to setup connection pooling -spring.datasource.type=com.zaxxer.hikari.HikariDataSource -spring.datasource.hikari.minimum-idle=5 -spring.datasource.hikari.maximum-pool-size=15 -spring.datasource.hikari.auto-commit=true -spring.datasource.hikari.idle-timeout=30000 -spring.datasource.hikari.pool-name=DatebookHikariCP -spring.datasource.hikari.max-lifetime=1800000 -spring.datasource.hikari.connection-timeout=30000 -spring.datasource.hikari.connection-test-query=SELECT 1 +#spring.datasource.type=com.zaxxer.hikari.HikariDataSource +#spring.datasource.hikari.minimum-idle=5 +#spring.datasource.hikari.maximum-pool-size=15 +#spring.datasource.hikari.auto-commit=true +#spring.datasource.hikari.idle-timeout=30000 +#spring.datasource.hikari.pool-name=DatebookHikariCP +#spring.datasource.hikari.max-lifetime=1800000 +#spring.datasource.hikari.connection-timeout=30000 +#spring.datasource.hikari.connection-test-query=SELECT 1 logging.config=classpath:logback-spring.xml