본문 바로가기

spring boot17

[회원 관리 예제, 백엔드 개발 - (5)] 회원 서비스 테스트 git repository : https://github.com/Rezalog/spring-boot-entry-inf GitHub - Rezalog/spring-boot-entry-inf Contribute to Rezalog/spring-boot-entry-inf development by creating an account on GitHub. github.com 구현한 회원 서비스, MemberService 를 테스트하기 위한 코드를 작성해보자. 이때 테스트 코드 작성시, given-when-then 으로 나누어 작성하는 습관을 들이자! (**cmd + shift + T 로 테스트 자동 생성이 가능 !) MemberServiceTest beforeEach MemoryMemberRepository 은 .. 2022. 6. 30.
[회원 관리 예제, 백엔드 개발 - (4)] 회원 서비스 개발 git repository : https://github.com/Rezalog/spring-boot-entry-inf GitHub - Rezalog/spring-boot-entry-inf Contribute to Rezalog/spring-boot-entry-inf development by creating an account on GitHub. github.com 회원 서비스 : 회원 리포지토리와 도메인을 활용해서, 실제 비즈니스 로직을 구현한다. 실제로 구현해볼 서비스는 회원가입, 전체 회원 조회이다. MemberService class join(회원가입) - 기본 로직 도메인인 Member 타입으로 받은 회원정보로 중복 회원을 검증하고, repo에 저장한 뒤 Long type 의 id를 반환한다. .. 2022. 6. 30.
[회원 관리 예제, 백엔드 개발 - (1)] 비즈니스 요구사항 정리 git repository : https://github.com/Rezalog/spring-boot-entry-inf GitHub - Rezalog/spring-boot-entry-inf Contribute to Rezalog/spring-boot-entry-inf development by creating an account on GitHub. github.com 비즈니스 로직을 먼저 설정하고, 회원 도메인과 리포지토리를 만든다. 비즈니스 로직(스프링 생태계를 알아보기 위한 것이므로, 단순하게 작성) 데이터 : 회원ID, 이름 기능 : 회원 등록, 조회 DB 설정 안됨을 가정(memory) 리포지토리가 정상적으로 동작하는지 확인하기 위해 테스트 케이스를 작성한다. 실제 비즈니스 로직을 적용한 회원 서비.. 2022. 6. 29.
[스프링 웹 개발 기초 - (3)] API - API 방식 : 일단 view 에 관여하지 않고 서버간 데이터만 전달하는 방식으로 이해하자. hello-string method @ResponseBody : 해당 요청에 대한 HelloController가 helloString 메소드를 실행하여 처리할 때, 입력받은 query string 의 name 의 value 를 HTTP의 body 부에 직접 "hello + (name key의 value)" 형태로 넘겨준다. 즉, ResponseBody 어노테이션 때문에 view가 없이 데이터만 넘겨줌. html 태그 없이 body 부의 hello spring 만 보이는 상태. helloApi Method Hello static class 를 생성, helloApi 메소드에서 Hello 객체 인스턴스를 생성하여.. 2022. 6. 29.
[프로젝트 환경설정 - (3)] View 환경설정 7.1.6 의 Welcome Page 설명을 보면, 서버가 실행되고 루트로 접속하면 먼저 resources/static 경로의 index.html 을 먼저 찾고, 없으면 resources/templates 경로의 index 탬플릿을 찾는다고 한다. https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features Core Features Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use a variety of ext.. 2022. 6. 29.
[Spring Boot] Refactoring - IntelliJ 에서 Lombok 추가하기 리팩토링? : 코드의 구조나 성능을 개선 Lombok의 기능? : toString(), constructor, getter/setter 등 @Data 같은 어노테이션으로 필수코드들을 간편하게 생성가능 -> 필수코드 반복 최소화 IntelliJ에서 Lombok 추가 방법? 2022. 6. 27.