| package kro.rubisco.controller; 
 import java.util.Locale; 
 import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; 
 import kro.rubisco.config.BindExceptionWithViewName; import kro.rubisco.dto.MemberDTO; import kro.rubisco.service.MemberService; import lombok.RequiredArgsConstructor; 
 @Controller @RequiredArgsConstructor @RequestMapping("/member") public class MemberController { 
     private final MessageSource messageSource;     private final MemberService memberService;          @GetMapping()     public String getMemberInfo() {         return "member/getMemberInfo";     }          @GetMapping(params="act=signUp")     public String getSignUpView() throws Exception {         return "member/signUpForm";     }          @PostMapping()     public String insertMember(         @Validated @ModelAttribute("member") MemberDTO member,          BindingResult bindingResult,          @RequestParam("rePassword") String rePassword,         Locale locale     ) throws Exception {                  if(!member.getPassword().equals(rePassword)) {             bindingResult.addError(new FieldError("java.lang.String", "rePassword", "패스워드가 일치하지 않습니다."));         } 
         if(memberService.read(member.getEmail()) != null) {             bindingResult.rejectValue("email", "overlap.email", "동일한 이메일이 존재합니다.");         }                  if(bindingResult.hasErrors()) {             throw new BindExceptionWithViewName(bindingResult, "member/signUpForm", messageSource, locale);         }                  member.setGroupId(1L);         memberService.regist(member);                  return "redirect:/";     }          @PatchMapping()     public String updateMember(MemberDTO member) throws Exception {         memberService.modify(member);         return "redirect:/member";     }          @DeleteMapping()     public String deleteMember() throws Exception {         return "redirect:/";     } } |