Skip to content

Commit

Permalink
fix: MailSender Bean 중복 등록과 @DomainService로 인한 스프링 컨텍스트 로드 실패 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
scv1702 committed Aug 4, 2024
1 parent 14421ed commit 2ceee7b
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ include::{docdir}/project/commission-project.adoc[]

include::{docdir}/project/get-my-projects.adoc[]

== 프로젝트 미팅 신청
=== 프로젝트 미팅 신청

의뢰자는 프로젝트 지원자에게 미팅을 신청할 수 있습니다.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import es.princip.getp.domain.auth.application.VerificationCodeSender;
import es.princip.getp.domain.auth.exception.FailedVerificationCodeSendingException;
import es.princip.getp.domain.member.command.domain.model.Email;
import es.princip.getp.infra.mail.MailSender;
import es.princip.getp.infra.mail.EmailSender;
import es.princip.getp.infra.mail.command.SendMailCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.mail.MailException;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class MailVerificationCodeSender implements VerificationCodeSender {
public class EmailVerificationCodeSender implements VerificationCodeSender {

private final MailSender mailSender;
private final EmailSender emailSender;

private static String title() {
return "[GET-P] 회원가입 인증 코드";
Expand All @@ -38,7 +38,7 @@ public void send(final Email email, final String verificationCode) {
text(verificationCode)
);
try {
mailSender.send(command);
emailSender.send(command);
} catch (MailException exception) {
throw new FailedVerificationCodeSendingException();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package es.princip.getp.domain.people.command.domain;

import es.princip.getp.domain.common.annotation.DomainService;
import es.princip.getp.domain.people.exception.NotRegisteredPeopleProfileException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@DomainService
@Component
@RequiredArgsConstructor
public class PeopleProfileChecker {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package es.princip.getp.domain.project.command.domain;

import es.princip.getp.domain.common.annotation.DomainService;
import es.princip.getp.domain.common.domain.ClockHolder;
import es.princip.getp.domain.common.domain.Duration;
import es.princip.getp.domain.people.command.domain.People;
import es.princip.getp.domain.people.command.domain.PeopleProfileChecker;
import es.princip.getp.domain.project.exception.ClosedProjectApplicationException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.Clock;
import java.util.List;

import static es.princip.getp.domain.project.command.domain.ProjectApplicationStatus.APPLICATION_COMPLETED;

@DomainService
@Component
@RequiredArgsConstructor
public class ProjectApplier {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package es.princip.getp.domain.project.command.domain;

import es.princip.getp.domain.common.annotation.DomainService;
import es.princip.getp.domain.common.domain.ClockHolder;
import es.princip.getp.domain.common.domain.Duration;
import es.princip.getp.domain.project.exception.ApplicationDurationNotBeforeEstimatedDurationException;
import es.princip.getp.domain.project.exception.EndedApplicationDurationException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.Clock;

@DomainService
@Component
@RequiredArgsConstructor
public class ProjectCommissioner {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package es.princip.getp.domain.project.command.domain;

import es.princip.getp.domain.common.annotation.DomainService;
import es.princip.getp.domain.common.domain.MeetingSchedule;
import es.princip.getp.domain.member.command.domain.model.PhoneNumber;
import es.princip.getp.domain.people.command.domain.People;
import es.princip.getp.domain.people.command.domain.PeopleProfileChecker;
import es.princip.getp.domain.project.exception.NotApplicantException;
import es.princip.getp.domain.project.exception.NotClientOfProjectException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@DomainService
@Component
@RequiredArgsConstructor
public class ProjectMeetingScheduler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import es.princip.getp.domain.project.command.domain.Project;
import es.princip.getp.domain.project.command.domain.ProjectMeeting;
import es.princip.getp.domain.project.exception.FailedMeetingSendingException;
import es.princip.getp.infra.mail.MailSender;
import es.princip.getp.infra.mail.EmailSender;
import es.princip.getp.infra.mail.command.SendMailCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.mail.MailException;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class MailMeetingSender implements MeetingSender {
public class EmailMeetingSender implements MeetingSender {

private final MailSender mailSender;
private final EmailSender emailSender;

private String title(final Project project) {
return String.format("[GET-P] %s 미팅 신청", project.getTitle());
Expand Down Expand Up @@ -52,7 +52,7 @@ public void send(
text(project, meeting)
);
try {
mailSender.send(message);
emailSender.send(message);
} catch (MailException exception) {
throw new FailedMeetingSendingException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import es.princip.getp.infra.mail.command.SendMailCommand;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class MailSender {
public class EmailSender {

private final JavaMailSender mailSender;
private final MailSender mailSender;

@Async
public void send(final SendMailCommand command) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ScheduleMeetingRequestDescription {
public static FieldDescriptor[] description() {
final Class<?> clazz = ScheduleMeetingRequest.class;
return new FieldDescriptor[] {
getDescriptor("applicantId", "프로젝트 이름", clazz),
getDescriptor("applicantId", "지원자 ID", clazz),
getDescriptor("location", "미팅 장소", clazz),
getDescriptor("schedule.date", "미팅 날짜", clazz),
getDescriptor("schedule.startTime", "미팅 시작 시간", clazz),
Expand Down

0 comments on commit 2ceee7b

Please sign in to comment.