mirror of https://github.com/usbharu/Hideout.git
feat: 依存関係を修正
This commit is contained in:
parent
e5b744eef0
commit
7f1aec3398
|
@ -1,10 +1,12 @@
|
|||
package dev.usbharu.hideout
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@ConfigurationPropertiesScan
|
||||
class SpringApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package dev.usbharu.hideout.config
|
||||
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
|
||||
@Configuration
|
||||
class DatabaseConfig {
|
||||
|
||||
@Autowired
|
||||
lateinit var dbConfig: DatabaseConnectConfig
|
||||
|
||||
@Bean
|
||||
fun database(): Database {
|
||||
return Database.connect(
|
||||
url = dbConfig.url,
|
||||
driver = dbConfig.driver,
|
||||
user = dbConfig.user ?: "",
|
||||
password = dbConfig.password ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ConfigurationProperties("hideout.database")
|
||||
data class DatabaseConnectConfig(
|
||||
val url: String,
|
||||
val driver: String,
|
||||
val user: String?,
|
||||
val password: String?
|
||||
)
|
|
@ -0,0 +1,12 @@
|
|||
package dev.usbharu.hideout.config
|
||||
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@Configuration
|
||||
class HttpClientConfig {
|
||||
@Bean
|
||||
fun httpClient(): HttpClient = HttpClient(CIO)
|
||||
}
|
|
@ -3,11 +3,9 @@ package dev.usbharu.hideout.service.core
|
|||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.Instant
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
@Service
|
||||
open class SnowflakeIdGenerateService(private val baseTime: Long) : IdGenerateService {
|
||||
var lastTimeStamp: Long = -1
|
||||
var sequenceId: Int = 0
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package dev.usbharu.hideout.service.core
|
||||
|
||||
import org.springframework.context.annotation.Primary
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
// 2010-11-04T01:42:54.657
|
||||
@Suppress("MagicNumber")
|
||||
@Service
|
||||
@Primary
|
||||
object TwitterSnowflakeIdGenerateService : SnowflakeIdGenerateService(1288834974657L)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
hideout:
|
||||
database:
|
||||
url: "jdbc:h2:./test;MODE=POSTGRESQL"
|
||||
driver: "org.h2.Driver"
|
||||
username: ""
|
||||
password: ""
|
Loading…
Reference in New Issue