Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 공부기록
- 낭독
- 2024 1학기 기말 파이썬 프로젝트
- 해커스
- Til
- DRF
- 기록
- Python
- 가보자고
- 삽질일기
- 매일매일쓰자허무하지않게
- opencv
- 라즈베리파이
- 암영
- 불공단스터디
- 1학기
- Flutter
- 다시도전
- 백엔드
- djangorestframework
- 장고
- django
- 불공단_스터디
- 컴공과
- 불공단
- 파이썬
- to all the errors i loved
- 대학생
- SUNLOG
- UOPEOPELE
Archives
- Today
- Total
기술해록본
java.lang.IllegalArgumentException: rawPassword cannot be null 본문
Develop/To All The Errors I've Loved Before
java.lang.IllegalArgumentException: rawPassword cannot be null
HaeYoung_12 2024. 10. 6. 15:00java.lang.IllegalArgumentException: rawPassword cannot be null
at org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.encode
- 처음에는 BCryptPasswordEncoder 관련 @Autowired 문제라고 생각 했으나 블로그를 참고해보니
JSON BODY로 보내면 controller 에서 받을 때 인지를 할수 있게 @RequestBody 어노테이션을 작성했어야 하는데 붙이지 않아서 발생한 문제이다.
- 여기서
private static final Logger log = LoggerFactory.getLogger(userController.class);
@Autowired
private UserService service;
@PostMapping("/signup")
public ResponseEntity<?> SignUp(@Validated AddUserRequest addUserRequest, BindingResult result) {
if(result.hasErrors()) {
log.warn(result.toString());
return ResponseEntity.badRequest().body(result.getFieldError());
}
try {
Boolean flag=service.singUp(addUserRequest);
return ResponseEntity.ok().body(flag);
- 이렇게 수정했더니 해결
private static final Logger log = LoggerFactory.getLogger(userController.class);
@Autowired
private UserService service;
@PostMapping("/signup")
public ResponseEntity<?> SignUp(@RequestBody @Validated AddUserRequest addUserRequest, BindingResult result) {
if(result.hasErrors()) {
log.warn(result.toString());
return ResponseEntity.badRequest().body(result.getFieldError());
}
try {
Boolean flag=service.singUp(addUserRequest);
return ResponseEntity.ok().body(flag);
- 참고자료
https://grogrammer.tistory.com/42
[개발]🚨ERROR - java.lang.IllegalArgumentException: rawPassword cannot be null
🛤️상황 회원가입/로그인이 기존에 GET방식이었어서 POST 방식으로 바꾸려 하는데 이러한 오류가 발생하였다. 🌸과정 401 Unauthorized는 클라이언트 요청이 필요한 인증 자격증명을 제공하지 않았
grogrammer.tistory.com