본문 바로가기

Spring15

[Spring Boot] Spring 통합 테스트(@SpringBootTest, @Transactional) https://rezal.tistory.com/entry/%ED%9A%8C%EC%9B%90-%EA%B4%80%EB%A6%AC-%EC%98%88%EC%A0%9C-%EB%B0%B1%EC%97%94%EB%93%9C-%EA%B0%9C%EB%B0%9C-5-%ED%9A%8C%EC%9B%90-%EC%84%9C%EB%B9%84%EC%8A%A4-%ED%85%8C%EC%8A%A4%ED%8A%B8 [회원 관리 예제, 백엔드 개발 - (5)] 회원 서비스 테스트 git repository : https://github.com/Rezalog/spring-boot-entry-inf GitHub - Rezalog/spring-boot-entry-inf Contribute to Rezalog/spring-boot-entry-inf .. 2022. 7. 5.
[Spring DB 접근 기술 - (1)] JDBC, JPA와 h2 Database 설치 이전까지 Spring Boot의 MVC 패턴을 이용하여 Memory 방식으로 DB 를 처리했었다. 본격적으로 4가지의 DB 접근기술을 활용하여, h2 database 를 CRUD 하는 방법을 알아보자. (h2를 사용하는 이유는 별다른거 없고, DB가 가벼우며 admin 화면도 제공하기때문) DB 접근 기술의 종류 순수 JDBC : SQL을 활용하여 Application Server 와 DB을 연결할 수 있도록 하는 DB 접근 기술 Spring JDBCTemplate : Spring 이 JDBC의 중복제거하고 쉽게 SQL을 날릴 수 있도록 제공하는 템플릿 JPA : SQL도 직접 개발자가 작성하지 않고, JPA 내에서 처리할 수 있도록하는 기술, 객체를 DB에 쿼리없이 저장할 수 있다. Spring Dat.. 2022. 7. 5.
[회원 관리 예제 : 웹 MVC 개발] 홈, 회원 등록, 회원 조회 본격적으로 url 요청에 따른 Controller 들을 설정해주도록 하자. 홈 화면 추가 localhost:8080 요청 시, 홈 화면(home.html)으로 이동한다. 기존에 똑같은 매핑이 resource > static 에 index.html 로 존재했으나, @Controller 에서 Spring Container 가 먼저 매핑되는 화면을 먼저 찾기 때문에 home.html 이 우선적으로 보여진다. 회원 등록 form 태그에서 post로 "/members/new" 로 넘기고 해당 처리 메소드 create의 인자로 MemberForm 타입이 들어간다. createMemberForm에서 form 태그로 넘어온 input의 name key의 input value "spring" 을 MemberForm 의 .. 2022. 7. 1.
[회원 관리 예제, 백엔드 개발 - (3)] 회원 리포지토리 테스트 케이스 작성 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 메인 메소드나 Controller를 실행해서 테스트를 하기에는 준비 및 실행이 오래걸리고, 반복적으로 실행하거나 여러 테스트케이스를 한번에 실행하기 어려운 단점이 있다. 이를 해결하기 위하여 JUnit 을 이용한 테스트 케이스를 작성하고 테스트 해볼 수 있다. JUnit Test 과정 (1) - findById 구현한 interface 인 M.. 2022. 6. 29.
[회원 관리 예제, 백엔드 개발 - (2)] 회원 도메인과 리포지토리 만들기 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 Package domain : 비즈니스 로직에서 사용되고 DB에 저장되어 관리되기 위한 객체 Member repository : domain 객체를 저장하기 위함 MemberRepository(interface) MemoryMebmerRepository(interface impl) domain 식별자 id, 입력받을 회원 정보인 name 에 .. 2022. 6. 29.
[회원 관리 예제, 백엔드 개발 - (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.