티스토리 뷰

728x90

Service를 추상화

 

ServiceImpl로 구현체 이름을 변경

Controller 패키지에Service 인터페이스 생성

public interface UserService {

    User getByEmail(String email);

    User getById(long id);

    User create(UserCreate userCreate);

    User update(long id, UserUpdate userUpdate);

    void login(long id);

    void verifyEmail(long id, String certificationCode);
}
public interface CertificationService {
    void send(String email, long id, String certificationCode);
}
public interface PostService {

    Post getById(long id);

    Post create(PostCreate postCreate);

    Post update(long id, PostUpdate postUpdate);
}

 

기존의Service 구현체 의존성을Service 인터페이스가 받도록 수정

private final UserService userService;

 

 

ControllerTest 리팩토링

SpringBoot 어노테이션 전부 제거.

특정 유저 정보를 가져오는get 메서드만 필요함

Service 인터페이스를 분할

 

728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함