전체글236 [스프링 입문] 회원 서비스 개발 package hello.hellospring.service; import hello.hellospring.domain.Member; import hello.hellospring.repository.MemberRepository; import hello.hellospring.repository.MemoryMemberRepository; import java.util.List; import java.util.Optional; public class MemberService { private final MemberRepository memberRepository = new MemoryMemberRepository(); /** * 회원 가입 */ public Long join(Member member) { v.. 2021. 8. 29. [스프링 입문] 회원 리포지토리 테스트 케이스 작성 개발한 기능을 실행해서 테스트 할 때 자바의 main 메서드를 통해서 실행하거나, 웹 애플리케이션의 컨트롤러를 통해서 해당 기능을 실행합니다. 이러한 방법은 준비하고 실행하는데 오래 걸리고, 반복 실행하기 어렵고 여러 테스트를 한번에 실행하기 어렵다는 단점이 있습니다. 자바는 JUnit이라는 프레임워크로 테스트를 실행해서 이러한 문제를 해결합니다. 회원 리포지토리 메모리 구현체 테스트 package hello.hellospring.repository; import hello.hellospring.domain.Member; import java.util.*; public class MemoryMemberRepository implements MemberRepository { ... public void c.. 2021. 8. 29. [스프링 입문] 회원 도메인과 리포지토리 만들기 회원 객체 package hello.hellospring.domain; public class Member { private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } (Member.java) package hello.hellospring.repository; import hello.hellospring.domain.Member; import java.util.List; impor.. 2021. 8. 29. [스프링 입문] 비즈니스 요구사항 정리 일반적인 웹 애플리케이션 계층 구조 컨트롤러: 웹 MVC의 컨트롤러 역할 서비스: 핵심 비즈니스 로직 구현 리포지토리: 데이터베이스에 접근, 도메인 객체를 DB에 저장하고 관리 도메인: 비즈니스 도메인 객체, 예) 회원, 주문, 쿠폰 등등 주로 데이터베이스에 저장하고 관리됩니다. 클래스 의존관계 인터페이스로 구현 클래스를 변경할 수 있도록 설계 데이터 저장소는 RDB, NoSQL 등등 다양한 저장소 사용 가능 개발을 진행하기 위해서 초기 개발 단계에서는 구현체로 가벼운 메모리 기반의 데이터 저장소 사용 참조 스프링 입문-코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술 2021. 8. 29. 이전 1 ··· 35 36 37 38 39 40 41 ··· 59 다음