Computer Science
-
Spring boot 생성자 주입으로 사용해야 하는 이유Computer Science/Spring boot 2022. 10. 6. 17:30
생성자 주입은 객체를 처음 생성할 때 한번만 호출 됨으로 불변하다. autowired 같이 필드 주입으로 할 경우 test 등을 할 수 없게 된다. 그렇다고 setter 를 만들어 놓으면 어디선가 수정을 할 수 있게 됨으로 좋지 않은 코드가 된다. 최근에는 Lombok을 이용하여 @RequiredArgsConstructor 어노테이션을 추가하여 사용한다. final이 붙은 값들은 자동으로 생성자 주입코드를 만들어 준다.
-
Spring boot api test codeComputer Science/Spring boot 2022. 10. 6. 14:44
json을 포함하여 body를 받아야하는 post api로 test를 하겠다. test를 진행할 controller 이다. package com.lof.lofserver.controller.user; import com.lof.lofserver.controller.user.request.UserInfoDto; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/v1/user") public class UserController { @PostMapping("/create") public ResponseEntity create..
-
SOLIDComputer Science/Java 2022. 10. 5. 18:02
본 내용은 김영한님의 스프링 핵심원리 강의를 보고 작성하였습니다. https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81-%ED%95%B5%EC%8B%AC-%EC%9B%90%EB%A6%AC-%EA%B8%B0%EB%B3%B8%ED%8E%B8/dashboard 스프링 핵심 원리 - 기본편 - 인프런 | 강의 스프링 입문자가 예제를 만들어가면서 스프링의 핵심 원리를 이해하고, 스프링 기본기를 확실히 다질 수 있습니다., - 강의 소개 | 인프런... www.inflearn.com SRP - 단일 책임 원칙 - 한 클래스는 하나의 책임만 가져야한다. - 책임이라는 것이 모호한데 중요한 기준은 변경이다. 변경이 있을 때 파급 효과가 적으면 단일 책임 원칙을 잘 ..
-
Spring boot 와 Spring의 차이Computer Science/Spring boot 2022. 10. 5. 17:43
본 내용은 김영한님의 스프링 핵심원리 강의를 보고 작성하였습니다. https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81-%ED%95%B5%EC%8B%AC-%EC%9B%90%EB%A6%AC-%EA%B8%B0%EB%B3%B8%ED%8E%B8/dashboard 스프링 핵심 원리 - 기본편 - 인프런 | 강의 스프링 입문자가 예제를 만들어가면서 스프링의 핵심 원리를 이해하고, 스프링 기본기를 확실히 다질 수 있습니다., - 강의 소개 | 인프런... www.inflearn.com Spring boot 는 Spring framwork를 편리하게 사용할 수 있게 해준다. 이제는 spring 을 spring boot를 통해서만 이용한다고 해도 과언이 아니다. sp..
-
AWS Lambda Node.js 로 api call 하기Computer Science/Aws 2022. 9. 29. 17:06
람다에서 함수를 생성후 post 로 api call 함수를 만들어 봤다. data 까지 추가하여서 진행하는 원본은 아래와 같다. http 80 으로 보내려면 require 의 https 를 http로 변환하면 된다. const https = require('https'); const doPostRequest = () => { const data = { value1: 1, value2: 2, }; return new Promise((resolve, reject) => { const options = { host: 'www.example.com', path: '/post/example/action', method: 'POST', headers: { 'Content-Type': 'application/json..
-
Spring boot 비동기 처리 (Aysnc)Computer Science/Spring boot 2022. 9. 29. 14:24
비동기 처리의 thread 수 등을 설정 할 config 파일을 만들어준다. package com.server.pandascore.config; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurerSupport; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; @Configura..
-
Jira 변동사항 Slack에 알림주기.Computer Science/Slack 2022. 9. 8. 23:27
https://slack.com/intl/ko-kr/help/articles/218475657-Slack%EC%9A%A9-Jira Slack용 Jira Jira는 강력한 워크플로 및 프로젝트 추적 기능을 제공합니다. 팀에서 Jira를 사용하는 경우 Slack에서 나가지 않고도 이러한 앱 중 하나를 통합하여 최BAD+C... slack.com jira cloud를 사용함으로 jira cloud 앱을 우선 slack에 추가해준다. https://w1653473956-u0h476389.slack.com/apps/A2RPP3NFR-jira-cloud?next_id=0&tab=settings Jira Cloud Jira helps every team reach their full potential with pow..
-
React useRef를 사용하여 원하는 tag에 focus 주기.Computer Science/React 2022. 9. 4. 20:09
import { useRef, useState } from "react"; 사용할 Ref를 선언을 해준뒤 const authorInput = useRef(); const contentInput = useRef(); focus를 주고 싶을 때 사용한다. authorInput.current.focus(); contentInput.current.focus(); focus를 적용시킬 tag에 ref를 등록한다.