일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- neo4j 인덱스 사용
- BFS
- GET REQUESTS
- 그랜빌의 법칙
- 백준
- neo4j
- cs50
- pandas-profiling
- gensim_models
- 플로이드워셜
- 투포인터
- gensim size
- 백준 7795
- 백준 2470
- neo4j 제약조건
- UnsatisfiedDependencyException
- Sequenial
- 알고리즘
- 첫서버
- PREFECT
- 텍스트전처리
- express
- 파이썬
- 백준 회전초밥
- 워드 임베딩
- neo4j 스키마 정의
- gensim
- spring-boot2
- spring-boot3
- nodemon babel
- Today
- Total
정리정돈
[내가 마주한 에러] Swagger2 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDocumentationScanner' 본문
[내가 마주한 에러] Swagger2 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDocumentationScanner'
XZXXZX 2023. 8. 6. 17:33강의를 보며 설정 중에 Swagger를 Spring-Boot에 적용시키려고 하는데 에러를 마주하게 되었다.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDocumentationScanner'
원인을 찾고자 여러 곳을 구글링 해가며 Swagger Configuration에 annotation을 추가해보기도 하고 그래보았었다.
@Configuration
@EnableSwagger2
@EnableWebMvc
위와 같이 변경해도 swagger가 적용되지 않고 swagger-ui.html로 들어가도 Whitelabel Error Page만 반복될 뿐이었다.
@Configuration을 지우면 해결된다는 글도 보았지만 빌드에는 성공해도
와 같은 alert를 마주할 뿐이었다.
좀 더 구글링 하며 찾아보니
Springfox(Swagger 제공)가 Spring Boot 3.0.x 버전에서 적용이 되지 않는다는 것이었다....
그후 구글링 도중 마주한 블로그에 해당 내용을 확인해볼 수 있었다.
https://hjh0827.tistory.com/96
[JAVA] Swagger 설정 및 오류 해결
서론 swagger를 설정하면서 했던 오류를 정리하고자 한다. swagger 2.X.X 설정 pom.xml io.springfox springfox-swagger2 2.9.2 io.springfox springfox-swagger-ui 2.9.2 build.gradle compile group: 'io.springfox', name: 'springfox-swagger2', ve
hjh0827.tistory.com
Spring boot 2.6버전 하위 - Swagger 2.x.x(swagger2)
Spring boot 2.6버전 상위 - Swagger 3.x.x
강의에서는 스프링부트 2.6버전 하위를 사용하고 있었기에 문제가 없었지만
나는 스프링부트 3.x 버전을 사용하고 있었기에 적용이 되지 않았던 것이었다.
아래를 보면 스프링부트 3.x 버전은 javax 대신 jakarta를 사용하고 있는데
Swagger(spring-fox)의 경우에는 javax를 사용하고 있어 안되고 있기에 스프링부트 3.x 버전에서는 swagger는 사용이 안될것이라고 나와있다.
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
스프링부트 3.x에서 swagger를 적용하고 싶다면 아래 블로그를 참조해서 적용시킬수 있다.
https://velog.io/@kjgi73k/Springboot3%EC%97%90-Swagger3%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0
Springboot 3.x에 Swagger를 적용시켜보자!
Springboot 3.0.1에서 Swagger 3.0.0을 적용 중 발생하는 에러들을 해결해 보자
velog.io
블로그에 나온 내용을 보면 종속성을 추가해서 스웨거를 사용할 수 있다는 것이다.
springdoc 을 추가해서 http://localhost:8080/swagger-ui.html 로 접근하게 되면
리다이렉트 돼서 http://localhost:8080/swagger-ui/index.html로 가게 되고
정상적으로 swaggerUI 페이지에 접근할 수 있었다.
SwaggerConfiguration에서 @Configuration 어노테이션은 빼주었다.
https://stackoverflow.com/questions/74614369/how-to-run-swagger-3-on-spring-boot-3
How to run Swagger 3 on Spring Boot 3
Using a fresh Spring Initialzr with Java17 and Spring Boot 3.0.0, and an extra addition to the pom.xml for Springfox Swagger 3, I can't for the life of me get Swagger pages to work. Instead, I get ...
stackoverflow.com
강의를 보더라도 버전확인 알아서 잘하자;
개선사항 : 강의와 동일한 환경을 구축하거나 내가 구축한 환경에 맞게끔 환경설정하자