commit
112a9fa97b
|
|
@ -28,3 +28,7 @@
|
|||
* `SecureRandomStringGenerator` - генератор случайной строки по словарю
|
||||
* `errors.*` - базовые исключения
|
||||
* `<type>.*Utils` - утилиты для различных типов данных
|
||||
|
||||
## common-spring
|
||||
|
||||
Набор утилит, структур данных для `spring`, без привязки к доп. модулям, таким как `jpa` и `web`
|
||||
|
|
|
|||
|
|
@ -69,4 +69,3 @@ subprojects {
|
|||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
plugins {
|
||||
id("kotlin")
|
||||
id("kotlin-spring")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
|
||||
implementation("org.springframework.boot:spring-boot")
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
package ru.touchin.common.spring
|
||||
|
||||
object Ordered {
|
||||
|
||||
const val NORMAL = 16384
|
||||
const val HIGH = NORMAL / 2
|
||||
const val HIGHER = HIGH / 2
|
||||
const val LOW = NORMAL * 2
|
||||
const val LOWER = LOW * 2
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package ru.touchin.common.spring.annotations
|
||||
|
||||
import org.springframework.boot.context.event.ApplicationStartedEvent
|
||||
import org.springframework.context.event.EventListener
|
||||
|
||||
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
|
||||
@EventListener(value = [ApplicationStartedEvent::class])
|
||||
annotation class RunOnceOnStartup
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
package ru.touchin.common.spring.io
|
||||
|
||||
import org.springframework.core.io.ClassPathResource
|
||||
import java.io.InputStream
|
||||
|
||||
object IOUtils {
|
||||
|
||||
fun getInputStreamOfResourceFile(fileName: String): InputStream = ClassPathResource(fileName).inputStream
|
||||
|
||||
fun getResourceAsString(filename: String): String = getInputStreamOfResourceFile(filename)
|
||||
.use { String(it.readBytes()) }
|
||||
|
||||
}
|
||||
|
|
@ -20,3 +20,4 @@ pluginManagement {
|
|||
}
|
||||
|
||||
include("common")
|
||||
include("common-spring")
|
||||
|
|
|
|||
Loading…
Reference in New Issue