Understand ArgumentResolver
This commit is contained in:
@@ -39,7 +39,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf().disable()
|
||||
.formLogin().disable()
|
||||
.formLogin().disable()//loginPage("/user/signIn")
|
||||
.authorizeRequests()
|
||||
.antMatchers("/", "/user/signUp").permitAll()
|
||||
.anyRequest().authenticated();
|
||||
|
||||
@@ -4,7 +4,6 @@ import demo.api.user.domain.User;
|
||||
import demo.api.user.dtos.UserSignUpRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -20,7 +19,7 @@ public class UserController {
|
||||
private final UserService userService;
|
||||
|
||||
@PostMapping("/signUp")
|
||||
public User signUp(@ModelAttribute @Validated UserSignUpRequest signUpReq) throws Exception {
|
||||
public User signUp(@Validated UserSignUpRequest signUpReq) throws Exception {
|
||||
return userService.signUp(signUpReq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,4 @@ public interface UserService {
|
||||
* @return 수정된 User
|
||||
*/
|
||||
User updateUser(User user, String newInfo);
|
||||
|
||||
// /**
|
||||
// * 이메일 중복 여부를 확인
|
||||
// *
|
||||
// * @param email
|
||||
// * @return true | false
|
||||
// */
|
||||
// boolean isEmailExist(String email);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public User signUp(UserSignUpRequest signUpReq) throws Exception {
|
||||
System.out.println("signUpReq = " + signUpReq.toString());
|
||||
if(this.isEmailExist(signUpReq.getEmail())) {
|
||||
throw new Exception("Your Mail already Exist.");
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@ToString
|
||||
public class UserSignUpRequest {
|
||||
@NotEmpty(message = "Please enter your Email")
|
||||
@Email
|
||||
|
||||
Reference in New Issue
Block a user