Spring security 적용시 기본적으로 csrf를 막기위하여 활성화 되어 있다 때문에 csrf 체크를 하여 @GetMapping 호출 시 문제가 없지만@PostMapping 호출 시 404에러 발생한다. 이것을 해결 하기 위해서는 Security 설정 파일에서 csrf().disable()를 삽입하면 해결 가능하다.
@Override
protected void configure(HttpSecurity http) throws Exception {
log.info("아래 코드 삽입");
http.csrf().disable();
}
'Spring boot' 카테고리의 다른 글
Spring boot Lombok 활성화 (0) | 2020.07.05 |
---|---|
Springboot Junit 사용시 @TestPropertySource 에러 (0) | 2020.06.22 |
Spring boot @RequestBody 로 JSON 데이터 받을 시 JSON parse error (2) | 2020.05.19 |
Spring boot jsp와 Thymeleaf 사용하기 (2) | 2020.05.16 |
Spring boot Controller test (0) | 2020.05.15 |