본문 바로가기

전체보기

List를 varargs( '...' ) Arguments로 처리해야 하는 경우 - Kotlin varargs로 받는 메소드를 사용시 List 처리를 해야 하는 경우가 생기고는 한다. 대표적으로 보면 queryDsl의 .orderBy(OrderSpecifier ...) 꼭 List로 뭔가 하는건 아닌데 정말 간혹 위와 같은 상황을 맞이하면 java에서는 대충 이런식이 될 듯 하다. ... .orderBy(orderSpecifiers.toArray(new OrderSpecifier[0])) ... 그럼 코틀린의 경우는 이런식이 되겠네..오호. '*' 이것을 주목하자 ... .orderBy(*orderSpecifiers.toTypedArray()) ... 더보기
MySQL : Order By RAND() - JPA QueryDSL JPA + QueryDSL 의 MySQL환경에서 정말 간혹 rand() 함수를 사용해서 order by를 걸고 싶을때가 있다. where(xxx) .orderBy(NumberExpression.random().asc()) .limit(100000) // 뭐 대충 이런... MySQL은 안된다. 별도의 Template를 만들던가 해야 하는데 그냥 가볍게 사용할거면 아래와 같이 하자. .where( WhereClauseBuilder.builder().build() ).orderBy( Expressions.numberTemplate(Double::class.java, "function('rand')").asc() ) 무겁게는 사용하지 말자. 더보기
Kotlin Unit Test https://phauer.com/2018/best-practices-unit-testing-kotlin/ Best Practices for Unit Testing in Kotlin Best practices and guidelines for idiomatic and readable unit tests in Kotlin. phauer.com 더보기
버전 맞추기 힘들다... IDE 환경에서 문제없이 Application 이 실행되는데 EC2에 올라가면 main()을 찾을 수 없다고 내게 자꾸 토를 단다. 뭐지 왜지... 하.. 첨부터 디컴파일 해봤으면 바로 알 수 있는 내용인데 말이지. 1. Main Class 관련 https://stackoverflow.com/questions/56861256/gradle-build-failed-main-class-name-has-not-been-configured-and-it-could-not-be Gradle build failed: Main class name has not been configured and it could not be resolved I am building a RESTful web service with Spri.. 더보기
Jenkins Remote API Trigger 간단하게 만들어보기. 서비스를 운영하다보면 간혹 해당 서비스 코드에서 직접 Jenkins의 Task Item을 실행하고 싶을 때가 있다. 어쩌다 한번 콜 하는 형태라 이를 위해 뭔가 막 만들기도 그렇고 해서 난감한 경우가 있는데..여튼.. 그냥 자료 찾아보고 대충 만들어 보자. 음... HTTPS 무시하는게 좀 뜬금이였음. ( HttpClient 4.5 + ) 라이브러리로 사용하기 https://github.com/cdancy/jenkins-rest GitHub - cdancy/jenkins-rest: Java client, built on top of jclouds, for working with Jenkins REST API Java client, built on top of jclouds, for working with.. 더보기