본문 바로가기

전체 글57

싱글톤 - 리플렉션API 공격과 방어 싱글톤을 만드는 방식은 여러가지가 있는데 그 중 정적 팩토리 메서드를 사용하여 만드는 방법을 살펴보자. public class SingletonTest { private static SingletonTest instance = new SingletonTest(); private SingletonTest() { System.out.println("SingletonTest Instance Generated"); } public SingletonTest getInstance() { if (instance == null) { instance = new SingletonTest(); } return instance; } } SingletonTest 클래스 생성자를 외부에서 호출할 수 없도록 생성자에 privat.. 2023. 7. 2.
생성자 대신 정적 팩토리 메서드를 고려하라 정적 팩토리 메서드? : 객체 생성의 역할을 하는 클래스 메서드 이펙티브 자바 Item-01에서는 생성자 대신 정적 팩토리 메서드를 고려하라고 한다. 생성자 대신 정적 팩토리 메서드를 사용하면 얻는 이점은 무엇일까? 코드 예시를 통해서 정적 팩토리 메서드를 알아보자. 특징 1. 이름을 가질 수 있다. 다음과 같은 상품(Item) 클래스와 생성자가 있다고 하면 public class Item01Data { private String itemName; private Integer price; private Long id; // id는 Repository가 부여함 public Item01Data(String itemName, Integer price) { this.itemName = itemName; this.. 2023. 7. 1.
SSAFY 10기 전공자 합격 후기 (서울 캠퍼스) 프로세스 : 서류 -> 코딩테스트 -> 인터뷰(면접) -> 합격 1. 서류 A) 내가 생각하는 개발자란 어떤 사람인가? B) 42서울에서 진행했던 팀프로젝트 경험 + 느낀점 C) 싸피 지원한 이유 위 3가지를 글에 녹이려고 노력했다. 글자 제한이 600자여서 일단 쓰고 싶은 내용을 쭉 쓰고 필요 없는 내용은 다 쳐냈다. 자소서를 다 쓰고 주변 지인들에게 첨삭을 부탁했고, 큰 도움이 되었다. 2. 코딩테스트 전공자는 코딩테스트를 보는데, 오후반 시험을 봤다. 22년 9월부터 코딩테스트 준비를 시작해서 싸피 코테는 큰 걱정이 없었다. 시험 시작 1시간 후부터 퇴실이 가능했는데, 30분에 다 풀고 나머지 시간은 놓친 테스트케이스는 없나 확인하는 시간을 가졌다. tip) 꼭 시험전에 https://swexper.. 2023. 6. 21.
02) Nest.js JWT인증 + RoleGuard 가이드 전체 코드 : https://github.com/jeounpar/nestjs-jwt-roleguard-tutorial 1. role-guard.decorator.ts 파일 생성 import { SetMetadata } from '@nestjs/common'; export const Roles = (...roles: string[]) => SetMetadata('roles', roles); @Role() 데코레이터로 사용된다. 2.auth.guard.ts 파일 수정 import { CanActivate, ExecutionContext, Injectable, UnauthorizedException, } from '@nestjs/common'; import { JwtService } from '@nestjs/.. 2023. 6. 9.
01) Nest.js JWT인증 + RoleGuard 가이드 전체 코드 : https://github.com/jeounpar/nestjs-jwt-roleguard-tutorial JWT란 무엇인가요? https://jwt.io/introduction JWT.IO JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. jwt.io 1. nest 프로젝트 생성 및 auth 모듈 생성 $ nest new jwt-tutorial $ cd jwt-tutorial $ nest generate module auth $ nest generate service auth $ nest generate controller auth 2.. 2023. 6. 9.
개발자 면접 예상 질문 리스트 자바스크립트 https://github.com/ganqqwerty/123-Essential-JavaScript-Interview-Questions GitHub - ganqqwerty/123-Essential-JavaScript-Interview-Questions: JavaScript interview Questions JavaScript interview Questions. Contribute to ganqqwerty/123-Essential-JavaScript-Interview-Questions development by creating an account on GitHub. github.com 타입스크립트 https://www.interviewbit.com/typescript-interview-que.. 2023. 6. 8.