diff --git a/pom.xml b/pom.xml index e73485c..4466549 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-aop + com.fasterxml.jackson.module jackson-module-kotlin @@ -51,6 +55,11 @@ 3.0.3 test + + mysql + mysql-connector-java + 8.0.33 + diff --git a/src/main/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplication.kt b/src/main/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplication.kt index 86f5273..ed3a7cd 100644 --- a/src/main/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplication.kt +++ b/src/main/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplication.kt @@ -2,8 +2,12 @@ package com.xlf.dromstarkotlin import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication +import org.springframework.context.annotation.EnableAspectJAutoProxy +import org.springframework.scheduling.annotation.EnableScheduling @SpringBootApplication +@EnableAspectJAutoProxy +@EnableScheduling class DromStarKotlinApplication fun main(args: Array) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8b13789..2c9eab5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1 +1,6 @@ - +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://192.168.5.190:3306 + username: dormstar + password: 114477225588 \ No newline at end of file diff --git a/src/test/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplicationTests.kt b/src/test/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplicationTests.kt index 4c65182..28ff68b 100644 --- a/src/test/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplicationTests.kt +++ b/src/test/kotlin/com/xlf/dromstarkotlin/DromStarKotlinApplicationTests.kt @@ -2,12 +2,32 @@ package com.xlf.dromstarkotlin import org.junit.jupiter.api.Test import org.springframework.boot.test.context.SpringBootTest +import java.util.* @SpringBootTest class DromStarKotlinApplicationTests { - @Test fun contextLoads() { + var token = (Date().time/1000).toString() + val random = Random() + // 判定随机范围 + var i: Int + var j = 0 + while (j++ < 3) { + val x: Int = if(j == 1 || j == 2) 6 else 10 + token += "-" + i = 0 + while (i < x) { + if (random.nextBoolean()) { + token += random.nextInt(10) + } else { + token += random.nextInt(97, 123).toChar() + } + i++ + } + } + println(token) + assert(true) } }