본문 바로가기

전체 글7

Kotlin Reflection Reflection이란? 런타임 시에 프로그램 내부의 구조적인 정보를 얻거나, 구조를 수정하는 것이 가능하게 하는 기술입니다. 더보기 더보기 더보기 Reflection is a set of language and library features that allows you to introspect the structure of your program at runtime. Functions and properties are first-class citizens in Kotlin, and the ability to introspect them (for example, learning the name or the type of a property or function at runtime) is essential.. 2021. 12. 19.
[Kotlin] Char타입을 Int로 변환하는 방법 Kotlin Standard Library는 다양한 Helper Function을 제공한다. "12345"라는 값이 있을 때, String.toInt()는 String을 Int타입으로 캐스팅해준다. Java에서 Integer.parseInt(str)과 동일하다. 그렇다면 Char의 경우에는 어떨까? Char타입에도 Char.toInt() 함수가 있는데, "1" 값을 1로 변환해줄까? 정답은, NO! Char.toInt()는 ASCII값을 반환한다. class Test { @Test fun test() { val str = "12345" println("str.toInt(): ${str.toInt()}") str.forEach { c -> println("c.toInt(): ${c.toInt()}") pr.. 2020. 6. 23.
[Spring Cloud Gateway] SetRequestHeader Host 설정 안먹는 문제 문제상황 SetRequestHeader=Host, my-domain.com으로 설정했는데, downstream 헤더에서 해당 값을 받지 못하는 문제. But, 2.2.0.RELEASE에서는 안되고, 2.2.0.RC에서 된다?! 관련 자료 비슷한 내용의 글이 있었음. 관련 커밋도 보고 NettyRoutingFilter를 확인해보기로 했음 왼쪽이 RELEASE이고 오른쪽이 RC버전인데, 릴리즈에서 // Will either be set below, or later by Netty headers.remove(HttpHeaders.HOST); 이 부분의 코드가 추가됨. 그래서 릴리즈 버전의 경우, 해당 Host를 유지하게 하려면 PreserveHostHeader을 추가해야하는 거였음 > RELEASE: Pres.. 2020. 6. 2.
[Spring Cloud Gateway] Route, Predicates, Filter 기본 개념 주요개념설명 1. Routing Handler (RouteLocator) spring: profiles: sandbox cloud: gateway: routes: - id: spring_cloud_test_id uri: http://my_url predicates: - Path=/api/v1/**, /api/v2/** filters: - SetRequestHeader=Host, my-domain.com - MyCustomFilter @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { return builder.routes() .route("r1", r -> r.host("**.baeldung.com") .and() .pa.. 2020. 6. 2.
맥(MAC OSX)에 Java 여러버전 설치하기 (feat. jenv) Homebrew를 이용한다는 가정하에, brew와 jenv로 Java 버전을 여러개 설치해봅시다. brew 커맨드 맛보기 > brew list : 현재 내 PC에 깔려 있는 패키지 목록 조회 > brew upgrade : 패키지 업그레이드 > brew --version : 버전 확인 jenv, cask 설치 > brew install jenv : jenv 설치 > brew install cask : cask 설치 > brew cask info java : 현재 java 최신버전 확인 java: 14.0.1,7:664493ef4a6946b186ff29eb326336a2 // 2020.05.19 기준 현재 최신버전 > brew cask install java : 현재 최신버전이 깔림 Java10을 깔고 싶다.. 2020. 5. 19.
실무에서 자주쓰는 인텔리제이 단축키 (Mac OS X 10.5+) 오늘은 mac에서 자주 쓰는 인텔리제이 단축키를 정리해보려고 해요. (IntelliJ Shortcut)실무에서 제가 자주 쓰는 키 위주로 정리해볼게요! 제 단축키는 MAC OS X 10.5+ 버전입니다. 전체 Keymap Reference는 여기를 참고하세요. Cmd(커맨드), Opt(옵션), Ctrl(컨트롤), Enter(엔터) 1. 계층구조 보기(Type Hierarchy) : Ctrl+H2. 메소드 시그니처 보기(File Structure Popup) : Cmd+F123. 구현체로(Go to type declaration) : Opt+Cmd+B4. 상위로(Go to super-method/super-class): Cmd+U5. 최근 파일보기(Recent Files Popup) : Cmd+E6. 자동.. 2020. 1. 13.
4.1.3. Receiving Messages - (1) MessageListenerContainer 카프카 메시지를 수신하는 방법 두 가지 1. MessageListenerContainer Configuring 2. @KafkaListener 어노테이션을 사용하여, 메시지 리스너를 구현 Message Listeners message listener를 위해 제공되는 8가지 인터페이스는 다음과 같다. public interface MessageListener { void onMessage(ConsumerRecord data); } public interface AcknowledgingMessageListener { void onMessage(ConsumerRecord data, Acknowledgment acknowledgment); } public interface ConsumerAwareMessageL.. 2019. 11. 18.