
JPA 를 사용하여 Repository Bean 을 생성할때 class 가 아닌 interface 로 선언하여 사용하게 된다. 어떻게 interface 만으로 객체가 생성되어 빈으로 등록되는지, 함수의 구현 없이 이름을 정의하는 것 만으로 쿼리가 만들어져서 동작하는지 궁금하여 조사를 시작하게 되었다. 아래 테스트 코드에 사용된 라이브러리 버전은 아래와 같다. implementation group: 'org.springframework', name: 'spring-context', version: '5.3.19' //AOP implementation group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.9.1' //JPA implementation gro..

AbstractAutoProxyCreatorSpring 에서는 AOP 기능을 수행하기위해 객체를 빈으로 등록하기 전에 Proxy 로 감싸진 클래스를 생성하여 빈으로 관리한다. 이때 사용되는 Proxy Library 가 CGLIB 와 Dynamic Proxy 이다. 이 중 CGLIB 가 만들어지는 과정을 코드 레벨로 확인한다. 테스트 코드 작성에 사용된 spring, aspectj 버전은 아래와 같다. implementation group: 'org.springframework', name: 'spring-context', version: '5.3.19' implementation group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.9.1' Spring..

RedirectAttributes 를 찾아보게 된 계기 운영중인 서비스에서 로그인 인증에 실패하면 아래와 같이 인증 실패 문구를 보여주고있다. 하지만 실패 문구가 보일때가 안보일때가 있다는 문의가 인입되었다. 실패 문구 노출 조건은 아래와 같이 Handlebars 로 작성되어있다. {{#if fail}} 비밀번호가 맞지 않습니다. {{else}} 로그인 시도시 동작 흐름은 아래와 같다. Login 에 실패할 경우 로그인 Page 로 다시 redirect 시키고 있다. 하지만 로그인에 실패하였을때 fail 여부를 전달하기 위해 Parameter 로 전달하지 않고 있다. 또한 Login Controller 에서 fail 에 대한 Attribute 를 넣어주고 있지도 않았다. 하지만 운영에서는 간헐적으로 동작..
Gateway 서버는 Proxied 도메인으로 부터 온 응답의 일부분을 임의로 수정하곤 한다. ex) HSTS Header 처럼 보안과 관련된 헤더를 모든 요청에 일괄적으로 넣어줄때 위와 같은 역할을 수행하기 위하여 GlobalFilter 에 Response Header 를 수정하려고 시도하면 아래와 같은 예외가 발생한다. @Override public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { return chain.filter(exchange).then(Mono.fromRunnable(() -> { exchange.getResponse().getHeaders().set("TEST_HEADER", "TEST_HEADER_VA..

MacOS 를 사용하여 Netty 의 NioEventLoop.java 가 사용되었습니다. WebClient -> Netty 로 전달되는 과정에 중점 WebClient 를 호출한 MainThread 에서 실행되는 영역 static { this.webClient = WebClient.builder().baseUrl("http://127.0.0.1:8090") .clientConnector(new ReactorClientHttpConnector(HttpClient.create().compress(true))) .build(); } @PostConstruct public void webClientTest() throws InterruptedException { while(true) { Thread.sleep(3..
입력된 데이터에 가장 부합하는 조건 찾는 코드.Collection.sort() 와 Compartor.java 를 활용한 것이 인상적이였으며 Spring 에서 HTTP Request 를 Handling 할 RequestMapping 을 찾을때 사용되는 코드를 눈으로 확인하여서 흥미로웠다. RequestMapping 에는 여러가지 조건이 들어갈 수 있다.@RequestMapping(value = { "/main" }, method = { RequestMethod.GET, RequestMethod.POST }, headers="X-PROXY-DEVICE=MOBILE") @RequestMapping(value = { "/main" }, method = { RequestMethod.GET, RequestMetho..
Meta Data 에 GlobalFilter 에 대한 정의도 포함되어 있다. 따라서 GlobalFilter 도 런타임에 Load 하고 bean 으로 등록해야 한다. GLOBAL_CONFIG.json { "filters" : [{ "filterName" : "HostSettingFilter", "args" : { "host" : "my-host.comm" } }, { "filterName" : "GlobalLoggingFilter", "args" : {} }, { "filterName" : "UnsupportedBrowserFilter", "args" : { "unsupportedBrowserRegx" : ".*(MSIE [1-7]\\.).*" } }] } 각 GlobalFilter 에 대한 코드는 이미 ..
ROUTE_CONFIG.json [{ "uri" : "https://www.naver.com", "connectionTimedOut" : "300000", "responseTimedOut" : "30000", "enabled" : "true", "predicates" : [{ "predicateType" : "Path", "args" : { "pattern_0" : "/blog/**" "pattern_1" : "/news/**" } }], "filters" : [{ "filterName" : "DeviceHeaderFilter", "args" : {} }] }, { "uri" : "https://www.daum.net", "enabled" : "true", "predicates" : [{ "predica..
Spring Cloud Gateway 의 설정을 Admin 페이지에서 관리자가 쉽게 수정할 수 있도록 하기 위해서 Route 와 Filter 설정을 Custom Meta Data 로 아래와 같이 정의 하였다. YML 파일의 Spring Cloud Gateway 의 설정을 저장하는 방법도 가능하지만 우리 도메인에 특화된 설정들을 추가하기 힘들다는 단점과 spring cloud gateway 에 강한 의존성이 생기는 단점을 해소하기 위해서 Custom Meta Data 를 정의하였고 이를 런타임에 Spring Cloud Gateway Configuration 으로 변환하였다. ROUTE_CONFIG.json [{ "uri" : "https://www.naver.com", "connectionTimedOut"..
- Total
- Today
- Yesterday
- ResultSet
- circurit breaker
- custom config data convertion
- notifyAll()
- Flux
- notify()
- dynamodb
- rate limit
- reative
- Lazy
- getBoolean
- mariada-connector
- AbstractMethodError
- MariaDB
- RoutePredication
- GlobalFilter
- wait()
- msyql-connector-java
- mariadb-connector-j
- aurora
- DyanomoDB
- HashMap
- Seperate Chaining
- router
- reactor
- ConcurrentHashMap
- RouteDefinition
- referencedColumnName
- spring cloud gateway
- N+1
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |