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