This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun <T> readJsonArrayFile(filePath: String): List<Map<*, *>?>? { | |
| val mapper = ObjectMapper() | |
| //val readFileAsString = readFileAsString(filePath) | |
| //println(readFileAsString) | |
| val myObjects = mapper.readValue(File(filePath), object : TypeReference<List<Map<*, *>?>>() {}) | |
| // for (obj in myObjects) { | |
| // println(obj) | |
| // } | |
| return myObjects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun readDataFromCsv(filePath: String): List<List<String>?> { | |
| var csvList: MutableList<List<String>?> = mutableListOf() | |
| val csv = java.io.File(filePath) | |
| try { | |
| BufferedReader(FileReader(csv)).use { br -> | |
| var line: String? | |
| while (br.readLine().also { line = it } != null) { | |
| //println("line $line") | |
| val split: List<String>? = line?.split(",") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val fetch = queryFactory.listQuery<Song> { | |
| select(entity(Song::class)) | |
| from(entity(Song::class)) | |
| fetch(Song::album, JoinType.LEFT) | |
| offset(pageable.offset.toInt()) | |
| limit(pageable.pageSize) | |
| where( | |
| isSongSearchable(searchCondition, Song::deletedAt) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| @DisplayName("s3ํ์ผ ์ ๋ก๋ ํ ์คํธ") | |
| fun s3FileUploadTest(){ | |
| val imgPath = "src/main/resources/static/img" | |
| val mockFile:MultipartFile = MockMultipartFile( | |
| "test1", | |
| "test1.png", | |
| "image/png", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Configuration(proxyBeanMethods = false) | |
| class BeanRegistry : ApplicationContextAware { | |
| companion object { | |
| private lateinit var applicationContext: ApplicationContext | |
| // ํ์ ์ผ๋ก ๋น์ ๊ฐ์ ธ์ต๋๋ค | |
| fun <T : Any> getBean(type: KClass<T>): T = | |
| applicationContext.getBean(type.java) | |
| // ์ด๋ฆ๊ณผ ํ์ ์ผ๋ก ๋น์ ๊ฐ์ ธ์ต๋๋ค | |
| fun <T : Any> getBean(name: String, type: KClass<T>): T = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Transactional | |
| fun saveCategory(dto:CategorySaveReq, idAncestor: Long?): Category? { | |
| val category = categoryRepository.saveCategory(dto.toEntity()) | |
| categoryRepository.saveCategoryClosure(category?.id!!, idAncestor ) | |
| return category | |
| } | |
| override fun saveCategoryClosure(idDescendant: Long, idAncestor: Long?) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let rds = { | |
| monUiCtl: [], | |
| isRun: false, | |
| ctlUIStart: function (idx, ch) { | |
| console.log("ctlUIStart????", idx, ch); | |
| this.monUiCtl[idx].value.changeLayout( | |
| 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun pathParsingTest() { | |
| val path = "/v1/members" | |
| log.info { | |
| path.split(delimiters = arrayOf("/"," ")).filter { it.isNotEmpty() }.forEach { | |
| println(" $it ") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @org.springframework.web.bind.annotation.RestControllerAdvice | |
| class RestControllerAdvice<T>( | |
| ) : ResponseBodyAdvice<T>{ | |
| private val log = KotlinLogging.logger { } | |
| override fun supports(returnType: MethodParameter, converterType: Class<out HttpMessageConverter<*>>): Boolean { | |
| //log.info { "returnType: $returnType" } | |
| return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun convertPojoToUrlEncodedFormData(obj: Any?): String { | |
| /** | |
| * ๊ฐ๋จํ ํจ์ input + output ํ ์คํธ๋ฅผ ์ํ๋ฏ๋ก, ObjectMapper๋ฅผ ์์กด์ฑ ์ฃผ์ ์ํค์ง ์๊ฒ ๋ค.(์คํ๋ง๊ณผ๋ ๋ ๋ฆฝ์ ์ธ) | |
| * util function๋ค์ ์ต๋ํ ์์กด์ฑ ์์ด | |
| * | |
| */ | |
| val map: Map<*, *>? = ObjectMapper().convertValue(obj, Map::class.java) |
OlderNewer