veluxer62 / veluxer62.github.io

veluxer's blog
http://veluxer62.github.io
MIT License
1 stars 0 forks source link

1월 개발이슈 #695

Open veluxer62 opened 5 months ago

veluxer62 commented 5 months ago
veluxer62 commented 5 months ago

srping boot 3.2.0으로 업그레이드 하면 발생하는 이슈

veluxer62 commented 5 months ago

JDK 21로 버전을 바꾸면 테스트 실행 시 아래와 같이 워닝이 발생한다.

WARNING: A Java agent has been loaded dynamically (/Users/kei/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy-agent/1.14.10/90ed94ac044ea8953b224304c762316e91fd6b31/byte-buddy-agent-1.14.10.jar)

TODO: 해결방법 추후 업데이트

아래 이슈를 참고하자.

https://github.com/mockito/mockito/issues/3037

veluxer62 commented 5 months ago

spring boot 3.2.0으로 업그레이드 하고 아래와 같은 워닝 문구가 노출된다. 현재 N+1문제로 인해 hibernate 6.4가 아닌 6.1.7 버전을 쓰고 있는데 6.4로 업그레이드하면 고쳐질 듯 하다.

https://github.com/spring-projects/spring-data-jpa/issues/3262

하지만 6.4로 올리려면 hypersistence-utils-64가 추가되어야 하는데 아직 미지원하는듯하다.

https://github.com/vladmihalcea/hypersistence-utils/issues/685

veluxer62 commented 5 months ago

Github에 Pull Request Template를 선택할 수 있는 기능이 있으면 좋겠다고 생각했는데 나만 그런게 아니었군 https://github.com/orgs/community/discussions/4620

veluxer62 commented 5 months ago

이전에 올렷던 DGS 관련 이슈가 해결되었다. https://github.com/Netflix/dgs-framework/pull/1796

지금까지 문제를 해결하기 위해 래핑해서 써왔는데 이제 해결할 수 있지 않을까

8.2.4 버전 이상에서 쓸수 있지 않을까 싶다

veluxer62 commented 5 months ago

captureLambda를 이용하면 아래처럼 람다를 캡쳐할 수 있다.. 중요한건 chatClient.leaveChannelAllUsers가 호출되는지이다.

// 운영코드
fun deleteStore(storeId: UUID) {
    storeService.deleteById(storeId) { channelUrl: String, sendbirdIds: List<String> ->
        chatClient.leaveChannelAllUsers(channelUrl, sendbirdIds)
    }
}

// 테스트 코드
test("매장 ID가 주어지면 매장을 삭제하고 채널에 사용자를 내보내기한다.") {
    // Given
    val id = generateId()
    val channelUrl = generateString()
    val sendbirdIds = listOf(generateString(), generateString())

    every {
        storeService.deleteById(id, captureLambda())
    } answers {
        lambda<(channelUrl: String, sendbirdIds: List<String>) -> Unit>().captured.invoke(channelUrl, sendbirdIds)
    }

    // When
    storeFacade.deleteStore(id)

    // Then
    verify { storeService.deleteById(id, any()) }
    verify { chatClient.leaveChannelAllUsers(channelUrl, sendbirdIds) }
}
veluxer62 commented 5 months ago

gradle cache 를 리모트로만 사용하고 있었는데 S3에 하는 방법도 있네.

https://github.com/burrunan/gradle-s3-build-cache?tab=readme-ov-file

veluxer62 commented 5 months ago

kotest에서 자동스캔 enable 시 속도가 느린 이슈가 있다. 그래서 아래와 같이 설정해주면 좋다.

## src/test/resources/kotest.properties

kotest.framework.classpath.scanning.config.disable=true
kotest.framework.classpath.scanning.autoscan.disable=true
kotest.framework.discovery.jar.scan.disable=true

https://github.com/kotest/kotest/issues/3126

veluxer62 commented 5 months ago

Query DSL의 대체제를 찾는데 Jooq와 JPQL 등을 고민중이다. 그와중에 라인에서 만든 JDSL이 있는데 JPA연동도 쉽고 괜찮은거 같다.

https://kotlin-jdsl.gitbook.io/docs/v/ko-1/