Swagger를 프로젝트에 적용 시 서버 에러 발생 - bondyuu/dodam GitHub Wiki
Trouble Shooting
Problem 1
- 프로젝트에 Springfox Boot Starter 3.0.0 적용 시 에러가 발생했다.(현재 프로젝트의 'org.springframework.boot' version 2.7.3)
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
Cause of the Problem 1
- Spring Boot version 2.6 이후 spring.mvc.pathmatch.matching-strategy 값이 ant_apth_matcher에서 path_pattern_parser로 변경되었다.
Solution of the Problem 1
- application.yml에 아래 문장을 추가한다.

Result of the Problem 1
- 프로젝트가 정상 작동한다.

Reference of the Problem 1
Problem 2
- Chrome에서 localhost:8080/swagger-ui/를 입력한 결과 아래와 같은 문제가 발생했다.

Cause of the Problem 2
- 현재 프로젝트에는 Spring Security가 적용되었다.
Solution of the Problem 2
- SecurityConfiguration 파일 내 filterChain 메소드에 swagger-ui 페이지 접속을 허용하는 코드를 추가한다. (밑의 사진에서 맨 아래 3개의 줄에 해당)

Result of the Problem 2
- swagger-ui 페이지 접속에 성공했다.

Reference of the Problem 2
- 없음