분류 전체보기
-
Project(Springboot) - 조회수 Count AOP_2카테고리 없음 2022. 11. 1. 01:54
Project(Springboot) - 조회수 Count AOP_1 바로가기 Project(Springboot) - 조회수 Count AOP_1 목적 Project(Springboot) - 조회수 Count AOP_2 바로가기 Project(Springboot) - 조회수 Count AOP_2 목적 지난번 1차 구현할때 발생한 문제인 DB의 조회수는 바로 올라가나 실제로 응답 하는 데이터에는 바로 반영 real-coding.tistory.com 목적 지난번 1차 구현할때 발생한 문제인 DB의 조회수는 바로 올라가나 실제로 응답 하는 데이터에는 바로 반영이 안되는 부분의 해결을 위해 코드 수정을 진행하였다. 구현 먼저 지난번 구현때 사용했던 @Before Advice는 별도 구현이 필요없다 판단하여 삭제후..
-
Project(Springboot) - 조회수 Count AOP_1카테고리 없음 2022. 10. 24. 22:30
Project(Springboot) - 조회수 Count AOP_2 바로가기 Project(Springboot) - 조회수 Count AOP_2 목적 지난번 1차 구현할때 발생한 문제인 DB의 조회수는 바로 올라가나 실제로 응답 하는 데이터에는 바로 반영이 안되는 부분의 해결을 위해 코드 수정을 진행하였다. 1차 구현 게시글 바로 가 real-coding.tistory.com 목적 현재 진행중인 프로젝트에서 게시물마다 조회된 전체 횟수를 카운팅 하는 기능이 필요했으며 세부적인 옵션은 아래와 같다 한 사람이 새로고침과 같은 부정한 방법으로 조회수를 올리는 기능을 방지 할 것 여러 게시물에 공통적용 될 수 있는 기능이니 코드 재활용성을 고려 할 것 구현 먼저 조회수 중복 카운팅을 막기 위한 방법을 조사 하여..
-
CS 100문 100답 Q.014(JPA의 상속 관계 매핑)카테고리 없음 2022. 10. 16. 22:18
키워드 풀이 관계형 데이터베이스에는 상속의 개념이 없다. 그래서 ORM에서는 객체의 상속 구조와 데이터베이스의 슈퍼타입 서브타입 관계를 매핑하여 사용한다. 이번에는 핑전략중 조인 전략, 단일 테이블 전략, 구현 클래스마다 테이블 전략에대해 알아보자. 조인 전략 엔티티 각각을 모두 테이블로 만들고 자식 테이블이 부모 테이블의 기본 키를 받아서 기본 키 + 외래 키로 사용하는 전략이다. 객체는 타입으로 구분이 가능하지만 테이블은 타입의 개념이 없기때문에 타입을 구분할 수 있는 별도의 컬럼을 추가해주어야 한다. @Entity @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "DTYPE") public abstract cla..
-
CS 100문 100답 Q.013(Test-Driven Development)카테고리 없음 2022. 10. 9. 21:18
키워드 풀이 013. TDD(테스트 주도 개발)? 테스트로부터 시작하는 개발 방식 (실패하는) 테스트 코드 작성 테스트를 통과시킬 만큼 구현 코드 정리(리팩토링) 테스트 코드작성 순서 쉬움 / 예외 → 어려움 / 정상 ex null 입력, 빈 값 입력 → 예외적인 것(정상이 아닌 것) 모두 충족하는 경우 → 쉬움 셋 중 둘을 충족하는 경우 → 그 다음 쉬움 … 모두 충족하지 않는 경우 완급 조절 TDD로 통과시키는 과정 정해진 값을 리턴 값 비교를 이용해서 정해진 값을 리턴 (다양한 테스트를 추가하면서) 구현을 일반화 구현이 생각나면 빠르게 구현 단 테스트를 통과시킬 만큼만! 앞서 가지 말 것! 구현이 막히면 다시 뒤로 돌아와서 천천히 진행 기능 설계 기능의 구성 : 입력, 결과 ex : 로그인 기능 입..
-
CS 100문 100답 Q.011~012(inheritance, implements)카테고리 없음 2022. 10. 2. 14:30
키워드 풀이 011. inheritance(상속)란 무엇인가? 사용 방법 : 클래스 이름 뒤에 extends + 상속받고자 하는 클래스(추상클래스 포함) 명 기존의 클래스를 재사용하여 새로운 클래스를 작성하는 것 적은 양의 코드로 새로운 클래스 작성 가능(재사용성) 코드를 공통적으로 관리할 수 있기 때문에 코드의 추가 및 변경이 용이(중복제거) ~은 ~이다 : is - a (”~은 ~을 가지고 있다 : has - a” 는 포함관계) 012. implements(구현)란 무엇인가? 인터페이스는 그 자체로는 인스턴스를 생성할 수 없다. 인터페이스 자신에 정의된 추상메서드의 몸통을 만들어주는 클래스를 작성하는데 사용 사용방법 : 클래스 이름 뒤에 implements + 구현하고자 하는 인터페이스명(여러개 가능..
-
CS 100문 100답 Q.006~008(filter, interceptor, AOP)카테고리 없음 2022. 8. 22. 13:15
키워드 풀이 Interceptor와 Filter는 Servlet 단위에서 실행되며 AOP는 메소드 앞에서 Proxy패턴의 형태로 실행. 요청이 들어오면 Filter => Interceptor => AOP => Interceptor => Filter 순으로 진행. 서버를 실행시켜 서블릿이 올라오는 동안에 init이 실행되고, 그 후 doFilter가 실행 컨트롤러에 들어가기 전 preHandler가 실행 컨트롤러에서 나와 postHandler, after Completion, doFilter 순으로 진행 서블릿 종료 시 destroy가 실행 006. Filter 란 무엇인가? 요청과 응답을 거른뒤 정제하는 역할. 서블릿 필터는 DispatcherServlet 이전에 실행되며 필터가 동작하도록 지정된 자원의..
-
CS 100문 100답 Q.004~005(Spring Web MVC, Spring Bean Life Cycle)카테고리 없음 2022. 7. 18. 08:59
키워드 풀이 004. Spring Web MVC 란 무엇인가? 개발시 사용되는 디자인 패턴. Model-View-Controller로 구성되며 client와 server의 로직을 분리하여 server에서의 수정이 client에 영향이 없도록 설계 Model 데이터 관리 및 비즈니스 로직을 처리 단순히 요청에 의한 로직만 처리하고 이 결과를 어디에, 어떻게 사용하는지는 전혀 상관하지 않음 ex. DAO, DTO, Service 등 View 비즈니스 로직 처리 결과를 통해 사용자 인터페이스가 표현되는 구간 Model을 통해 전달받은 데이터가 어떤 데이터인지 전혀 상관하지 않음. html, jsp 등 화면을 구성하기도 하고, Rest API 서버 구현시 json응답으로 구성 Controller Model과 V..
-
CS 100문 100답 Q.001~003(JPA, Spring Framework, Spring Boot)카테고리 없음 2022. 7. 11. 08:58
키워드 풀이 001. JPA(JAVA Persistent API) 란 무엇인가? 영속성 관리 도구로써 Java ORM 기술에 대한 API 표준이다. RDB를 사용함에 있어 SQL문 작성없이 데이터를 생성, 조회, 수정, 삭제를 가능하게 한다. ORM(Object Relational Mapping)? 객체와 테이블을 매핑해서 패러다임의 불일치를 개 JPA(ORM)는 왜 사용 하는가? 개발의 패러다임이 객체지향 중심으로 변하는 중이나 여전히 데이터 관리를 관계형 DB에서 하다 보니 객체 지향의 특징을 살리지 못하거나, 특징을 살리기 위해 SQL Mapping에 너무 많은 시간을 투자하게 되어 ROI(Return On Investment)가 굉장히 떨어지게 된다. 구체적인 문제점 무한반복의 CRUD 코드 반복..