[Spring] Springboot 3.x.x 에 스웨거 세팅하기

HYOJIN·2024년 7월 6일

트러블슈팅

목록 보기
4/5

Springboot 버전

Springboot 3.2.5 버전을 사용하였다.

문제

처음 스웨거를 세팅하기 위해 버전 생각을 안 하고 많이 쓰던 2.9.2 버전으로 아래와 같이 의존성을 추가하였다.

implementation 'org.springdoc:springdoc-openapi-ui:1.6.15'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'

하지만 http://localhost:8080/swagger-ui/index.html#/ 로 접속했을 때 404 error page가 나왔다.

해결

블로그 글과 스택오버플로우를 참고하였다.
https://velog.io/@kjgi73k/Springboot3%EC%97%90-Swagger3%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0

https://stackoverflow.com/questions/74614369/how-to-run-swagger-3-on-spring-boot-3

스프링 3.0 이상부터 springdoc v2를 사용하면 된다는 글이었다.

그래서 바로 적용해본 결과 잘 해결할 수 있었다.

profile
기록하자

0개의 댓글