UserService {
// CRUD
boolean isExists(String userId);
}
MailService {
void send(Mail mail);
}
UserExistsCheckMailService {
UserService userService;
MailService mailService;
void send(Mail mail) {
if (!userService.isExists(...)) {
throw Exception;
}
mailService.send()
}
}
同层依赖问题 可以考虑加个Facade