diff --git a/src/main/java/com/javajober/member/event/MemberSignupEventHandler.java b/src/main/java/com/javajober/member/event/MemberSignupEventHandler.java new file mode 100644 index 0000000..e14d338 --- /dev/null +++ b/src/main/java/com/javajober/member/event/MemberSignupEventHandler.java @@ -0,0 +1,23 @@ +package com.javajober.member.event; + +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import com.javajober.space.service.SpaceService; + +@Component +public class MemberSignupEventHandler { + + private final SpaceService spaceService; + + public MemberSignupEventHandler(final SpaceService spaceService) { + this.spaceService = spaceService; + } + + @EventListener(MemberSignupEvent.class) + @Async("threadPoolTaskExecutor") + public void handleMemberSignupEvent(final MemberSignupEvent event) { + spaceService.initializeAndSaveNewMemberSpaces(event.getMember()); + } +}