프로그래밍 48
프로그래밍 분류의 글을 최신순으로 모았어요.
- LINUX , UNIX
linux 서버 포트가 열려있는지 확인 방법 총정리
linux 서버 포트가 열려있는지 확인 방법 총정리 프로젝트 진행시 실전에서 아주 자주쓰는 기능중에 하나이다. 지금 이런 명령어를 호출해본다는 의미는 뭔가 대상서버로의 호출이 정상적이지 않기 떄문일거라고 생각된다. 실제 서비스가 떠있는지에 대한 확인을 하기도 하고, 금융권 같은곳에서 프로젝트를 하는경우에 방화벽이 오픈이 되어있는지 확인하는데 쓰이기도 한다. 1. telent {serverip} {port} 포트가 정상적으로 열려있는 경우 [ynkim@test ~]$ telnet 10.123.123.123 8080 Trying 10.123.123.123... Connected to 10.123.123.123. Escape character is '^]'. 포트가 정상적으로 열려 있지 않은 경우 [ynkim..
- JAVA
sonarQube - Public constants and fields initialized at declaration should be "static final" rather than merely "final"
sonarQube - Public constants and fields initialized at declaration should be "static final" rather than merely "final" Making a public constant just final as opposed to static final leads to duplicating its value for every instance of the class, uselessly increasing the amount of memory required to execute the application. Further, when a non-public, final field isn’t also static, it implies tha..
- JAVA
sonarQube - Field names should comply with a naming convention.
code smell - Field names should comply with a naming convention. Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that field names match a provided regular expression. Noncompliant Code Example With the default regular expression ^[a-z][a-zA-Z0-9]*$: sonarQube 정적분석에 code smell가 떠서 수정중에 있다. 문제 class MyClass { priva..
- SPRING BOOT
Zuul Exception customize - ERROR 처리하기
Zuul Exception customize - ERROR 처리하기 Zuul에서 예외 상황을 만들고 에러를 던졌더니, 아래와 같이만 나온다. Zuul Error Filter를 활용해서 원하는 방식으로 리턴 값을 만들어 보자 { "timestamp": "2022-07-17T23:16:07.563+00:00", "status": 500, "error": "Internal Server Error" } 1. Zuul sendErrorFilter를 비활성화 먼저 자동으로 구성된 sendErrorFilter를 비활성화 한다. application.yml에 설정하면 된다. zuul: SendErrorFilter: post: disable: true 2. ErrorFilter 를 생성하자 ZuulFilter를 상속 받..
- SPRING BOOT
Spring boot - HandlerInterceptorAdapter와 zuul Filter 의 사용시 문제
Spring boot - HandlerInterceptorAdapter와 zuul Filter 의 사용시 문제 [문제 발생 내용] Spring boot application에서 HandlerInterceptorAdapter에 들어오는 사용자의 IP를 체크하는 Interceptor를 넣어서 사용중이었다. 이후 Zuul Gateway api 가 필요하게 되어 을 적용했는데, Zuul 필터 구성후 인터셉터가 호출이 안되는것이었다. 좀 더 정확하게 이야기하면, Zuul routes 를 타는 경우에만 인터셉터가 호출이 안된다. [해결 방법] 간단하게 해결이 가능하다, 아래와 같은 Class를 생성해주면 된다. InstantiationAwareBeanPostProcessorAdapter를 상속받고 zuulMappi..
Zuul API GATEWAY - 초간단 설정
Zuul API GATEWAY - 초간단 설정 Zuul이 뭐야? Zuul은 Netflix에서 개발한 Gateway 오픈 라이브러리 이다. Gateway 는 뭐야? zuul lib를 이용하여 Gateway 서버를 만들수 있다. ( proxy 서버라고 표현하기도 함. ) MSA 에서 클라이언트에게 분산된 서비스의 단일 진입점 즉, 이는 일종의 출입문 역할을 하며, 뒷단의 API 서버들에게 라우팅 할수 있다. 또한 보안과 인증, 로깅과 같은 횡단 관심사를 각 서비스 마다 적용하려면 힘이 들기때문에 이를 이용하면 편하게 처리할수 있다. 일반적으로 ureka 와 함꼐 사용하며 아래 2장의 그림이 본 것중에 제일 잘 정리된거 같아 퍼왔다. Eureka 서버에 등록된 API 서버들 Ureka 서버에 API 서버들이 ..
