-
[Spring Boot]java.lang.TypeNotPresentException: Type javax.servlet.http.HttpServletRequest not present 에러 해결카테고리 없음 2024. 1. 12. 12:14
스프링 부트 버전이 3.x.x 일 때 springfox에서 제공하는 swagger를 사용하려고 하면 이런 에러가 발생한다.
swagger는 spring boot 3을 제공하지 않는다.
뚜렷한 코드 참조가 없다 gradle 기준으로 application.properties에 추가
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' //이 부분 swagger 지워주기 // implementation 'io.springfox:springfox-swagger-ui:3.0.0' // implementation 'io.springfox:springfox-swagger2:3.0.0'
이외에도 컨트롤러와 모델의 annotation을 springdoc으로 바꿔주고, SwaggerConfig.class 파일을 새로운 버전에 맞게 설정해줘야한다.
어노테이션의 경우 공식문서를 참고하는 것을 추천한다.
현재 쓰고 있는 어노테이션을 검색하면
- @ApiModel → @Schema
이런 식으로 친절하게 알려줍니당👍
https://springdoc.org/#features
OpenAPI 3 Library for spring-boot
Library for OpenAPI 3 with spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file.
springdoc.org
https://colabear754.tistory.com/99
[Spring Boot] Springdoc 라이브러리를 통한 Swagger 적용
목차 기본 환경 IntelliJ Ultimate 2022.3 Spring Boot 2.7.7 Kotlin 1.7.21(JDK 11) Springdoc Openapi UI 1.6.11 Springdoc은 무엇인가? 이전에 Spring Boot 프로젝트에 Swagger UI를 적용하는 포스트를 작성한 적이 있다. 해당 포
colabear754.tistory.com
성공결과!