본문 바로가기

분류 전체보기

(147)
Error saving credentials: error storing credentials - err: exit status 1, out: 로컬에서 AWS ECR 로그인을 하려는데 다음과 같은 에러가 떴다. Error saving credentials: error storing credentials - err: exit status 1, out: sudo vi ~/.docker/config.json 명령어를 친 다음 "credsStore": "osxkeychain" 이렇게 바꿔준다. 그리고 :wq 엔터. 그러면 로그인이 될 것이다. 출처: https://stackoverflow.com/questions/64455468/error-when-logging-into-ecr-with-docker-login-error-saving-credentials-not Error when logging into ECR with Docker login: "Err..
로컬에 저장된 AWS 시크릿키 찾기 터미널에서 cat ~/.aws/credentials 치기.
ModelMapper 사용 ModelMapper를 사용하니 Entity-DTO 전환이 한층 수월해졌다. 기존엔 생성자 혹은 builder를 사용하여 Entity-DTO 전환을 하였다. public class QnaRequestDto { private String title; private String content; public QnaRequestDto(Qna qna) { this.title = qna.getTitle(); this.content = qna.getContent(); } public static Qna toQna(QnaRequestDto qnaRequestDto) { return Qna.builder() .title(qnaRequestDto.getTitle()) .content(qnaRequestDto.getCont..
Leetcode 700. Search in a Binary Search Tree 자바 재귀 class Solution { public TreeNode searchBST(TreeNode root, int val) { if (root == null || val == root.val) return root; return val Optional[TreeNode]: while (root is not None and val != root.val): root = root.left if val < root.val els..
HATEOAS + Pagination 구현 https://stackoverflow.com/questions/63963571/is-there-a-simple-implementation-of-hateoas-pagination-in-spring-without-data
Leetcode - 104. Maximum Depth of Binary Tree - Java DFS if (root == null) return 0; int left = maxDepth(root.left); int right = maxDepth(root.right); // This is the part that counts the number of nodes. return 1 + Math.max(left, right); BFS same as the level order traversal. You just need to return the size or length of the list at the end. List levels = new ArrayList(); if (root == null) { return 0; } Queue queue = new LinkedList(); queue.add(ro..
스프링 Paging 및 Parameters public Page getFeedResponses(@RequestParam("page") int page, @RequestParam("size") int size, @RequestParam("sortBy") String sortBy, @RequestParam("isAsc") boolean isAsc) { page = page - 1; return feedService.getFeeds(page, size, sortBy, isAsc); 보통은 paging 할 때, 저렇게 파라미터를 다 전달한 다음, Sort.Direction direction = isAsc ? Sort.Direction.ASC : Sort.Direction.DESC; Sort sort = Sort.by(direction, sortBy); ..
Leetcode 102 - Binary Tree Level Order Traversal BFS class Solution: def levelOrder(self, root: Optional[TreeNode]) -> List[List[int]]: res = [] if root is None: return res q = collections.deque() q.append(root) # use queue data structure since this is a BFS - it goes from left to right. while q: qLen = len(q) # to ensure we're looping through one level at a time. # qLen represents the length of the nodes in each level. level = [] # current le..
Page<Entity>에서 Page<DTO>로 전환 https://spring.io/guides/tutorials/rest/ Building REST services with Spring this tutorial is designed to be completed in 2-3 hours, it provides deeper, in-context explorations of enterprise application development topics, leaving you ready to implement real-world solutions. spring.io Rest API의 HATEOAS를 구현하기 중에 Page를 return 하니, 아이디와 비밀번호가 다 노출되는 상황이 발생했다. Page qna = qnaService.getQnaAll(pageable)..
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method fail.. 컴파일 하는 데 다음과 같은 에러가 떴다. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate Sess..