본문 바로가기
Spring/Spring Study

[Spring] SpringBoot 3.X 버전 - Swagger 적용 오류 해결

by ♡˖GYURI˖♡ 2024. 4. 8.

SpringBoot 3.2.4 버전 프로젝트에 Swagger를 적용하려 했는데

Type javax.servlet.http.HttpServletRequest not present 라는 오류를 마주쳤다.

 

stack overflow의 관련 글⬇️

 

Springfox Type javax.servlet.http.HttpServletRequest not present

I'm trying to use SpringFox. Spring Boot version: 'org.springframework.boot:3.0.0-SNAPSHOT' build.gradle dependencies { ... implementation 'io.springfox:springfox-petstore:2.10.5' implementation &

stackoverflow.com

서치해봤더니 SpringBoot 3.0은 JavaEE가 아닌 JakartaEE용으로 빌드되었는데, JakartaEE를 지원하는 SpringFor 릴리즈가 없어서 오류가 발생한다고 한다.

 

해결방안은 2가지가 있었다.

  1. SpringBoot 버전 다운그레이드
  2. springdoc-openapi 사용

 

다운그레이드하고싶지는 않아서 2번째 방법을 선택하였다.

 

공식 문서 url

 

Springfox Type javax.servlet.http.HttpServletRequest not present

I'm trying to use SpringFox. Spring Boot version: 'org.springframework.boot:3.0.0-SNAPSHOT' build.gradle dependencies { ... implementation 'io.springfox:springfox-petstore:2.10.5' implementation &

stackoverflow.com

 

build.gradle에 해당 내용 추가했더니 해결~

implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0")

 

 

 

 

 

 


 

 

SpringBoot 3.x 버전 이상 프로젝트에 Swagger 적용 오류 해결 및 springdoc-openapi 적용

오류상황 SpringBoot3.1.2 버전 프로젝트에 Swagger를 적용하려고한다. https://devfunny.tistory.com/692 SpringBoot + SpringSecurity 프로젝트에 Swagger 3.0 적용하기 이전 버전 Swagger 2.0 적용 방법 https://devfunny.tistory.com

devfunny.tistory.com