본문 바로가기

전체 글105

Springboot: Content-Type 'multipart/form-data' is not supported 발생 상황 multipart/formdata 콘텐트 타입으로 이미지를 요청 body에 받을 때 문제 org.springframework.web.HttpMediaTypeNotSupportedException: Content-Type 'multipart/form-data;boundary=----WebKitFormBoundaryAwYdPgnCGZSXBO1H;charset=UTF-8' is not supported at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgument.. 2023. 9. 11.
SpringSecurity: SecurityFilterChain 설정 발생 상황 SpringSecurity 5.7.0부터 Deprecated 된 WebSecurityConfigurerAdapter 가 6.0부터는 아예 사용할 수 없게 되었습니다. 사용자가 컴포넌트 기반 보안 구성을 할 수 있도록 권장하기 위해서라고 합니다. In Spring Security 5.7.0-M2 we deprecated the WebSecurityConfigurerAdapter, as we encourage users to move towards a component-based security configuration. To assist with the transition to this new style of configuration, we have compiled a list of common.. 2023. 9. 11.
LeetCode : 230. Kth Smallest Element in a BST 문제 링크 문제 먼저 읽기 이진 검색 트리의 루트와 정수 k가 주어졌습니다. 트리에 있는 모든 노드의 값 중 K번째 가장 작은 값(1-indexed)을 반환합니다. 어떻게 풀까? 생각 root로부터 맨 왼쪽에 위치한 값이 제일 작은 값입니다. 거기서부터 시작해서 이전 노드, 오른쪽 노드 순서대로 탐색할 수 있는 재귀함수를 만듭니다. 수도코드 class Solution { int count = 0; int result = 0; public int kthSmallest(TreeNode root, int k) { count = k; search(root); return result; } public void search(TreeNode node) { if (node == null) return ; search.. 2023. 9. 8.
LeetCode : 530. Minimum Absolute Difference in BST 문제 링크 문제 먼저 읽기 이진 검색 트리(BST)의 루트가 주어졌을 때, 트리에 있는 서로 다른 두 노드의 값 사이의 최소 차이 절대값을 반환합니다. Input: root = [1,0,48,null,null,12,49] Output: 1 어떻게 풀까? 생각 주의! 처음에 문제를 잘못읽었었습니다. 역시 사람의 언어를 가장 잘해야 합니다 🥲 트리는 정렬 규칙상 인접 노드가 가장 그 차이가 적습니다. 그래서 인접하는 노드끼리 비교하면 안될까요? 재귀를 통해 BST 를 구현해봅시다. 수도코드 class Solution { TreeNode prev = null; int min = Integer.MAX_VALUE; public int getMinimumDifference(TreeNode root) { search.. 2023. 9. 8.
LeetCode : 148. Sort List 문제 링크 문제 먼저 읽기 linkedlist의 head인 ListNode가 하나 주어집니다. 이 리스트를 오름차순으로 정렬하고 head를 반환합니다. 시간복잡도 O(nlogN), 공간복잡도 O(1)의 답변이 있는 모양입니다 🫠 Can you sort the linked list in O(n logn) time and O(1) memory (i.e. constant space)? 어떻게 풀까? 생각 처음 문제를 읽고 좀 당황했습니다. linked list를 정렬을 다시 해본적이 없었기 때문입니다. 가장 먼저 든 생각은 새로운 LinkedList를 만들어서 이전 리스트를 탐색함과 동시에 새로운 리스트에 값을 넣어주는 것입니다. 이 경우 시간복잡도는 O(n^2)이 될 것으로 예상됩니다. 새로운 리스트에 값을.. 2023. 9. 5.
해시테이블 Hash table 해시테이블이란? https://en.wikipedia.org/wiki/Hash_table HashMap이라고도 알려진 해시 테이블(HashTable)은 키(Key)를 값(Value)로 매핑하는 추상 데이터 유형입니다. 내부적으로 연관 배열(associative array)나 딕셔너리(dictionary)을 사용하여 데이터를 저장합니다. 각 키Key에 해시 함수를 사용하여 해시코드라고도 하는 인덱스(index)를 생성하고 이 index 위치에 값(Value)가 저장됩니다. colors = { "Red" : "#FF0000", "Green" : "#00FF00", "Blue" : "#0000FF", "White" : "#FFFFFF", "Black" : "#000000", "Yellow" : "#FFFF00.. 2023. 9. 5.
Error: Cannot invoke because "this.repository" is null 발생 상황 PostgreSQL 에 hibernate로 처음 연동 후, 테스트용 API를 보내본 상황 java.lang.NullPointerException: Cannot invoke "project.labelingtool.backend.api.resource.adapter.out.persist.BankRepository.findAll()" because "this.repository" is null at project.labelingtool.backend.api.resource.adapter.out.persist.ResourceRepositoryImpl.findAllBanks(ResourceRepositoryImpl.java:24) ~[main/:na] at project.labelingtool.back.. 2023. 9. 2.
Error parsing HTTP request header 발생 상황 프로젝트 postman 으로 로컬환경에서 통합테스트 중 API 요청할 때 다음과 같은 에러가 발생하였다. 2023-09-02T22:10:25.550+09:00 INFO 72091 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x000xf70x010x000x0.. 2023. 9. 2.