1. 스웨거를 쓰려면 springfox-swagger-ui와 springfox-swagger2로 의존성 추가를 해줘야 한다.
https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui/3.0.0
https://mvnrepository.com/artifact/io.springfox/springfox-swagger2/3.0.0
나는 Gradle을 사용중이라 아래처럼 build.gradle에 갖다붙여넣었다.
그리고 스웨거 config를 만들고 어쩌꾸 저쩌구 다 했는데 ...
스프링 3.x 에서는 스웨거를 이전 버전과 다른 방법으로 사용한다고 한다 ...
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
공식문서는 이쪽에서 확인하면 될 것 같다. https://springdoc.org/
이건 데모버전 https://demos.springdoc.org/demo-spring-boot-3-webmvc/swagger-ui/index.html
일단 스프링 3.x 이상 프로젝트에서 스웨거를 연결하려면 레포지토리에서 springdoc을 가져다가 의존성 추가를 해주면 된다. 이전 스케쥴러도 그렇고 프로젝트가 점점 최신버전으로 넘어올수록 한 줄로 해결되는 정말 좋은 세상 ...
https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
그리고 별다른 config 파일은 만들지 않은 상태로 프로젝트를 구동하여 /swagger-ui/index.html 경로로 접속하면
이렇게 화면이 뜨게 된다.
config 설정관련해서는 https://colabear754.tistory.com/99 이쪽 블로그를 참고해서 만들었다.
이런 기본 설정같은건 다들 공식문서에서 알아낸후에 쓰는걸까 정말 대단하다
'개발공부 > 개발하다_발견함' 카테고리의 다른 글
스프링 3.x 부터는 자바 17이상만 사용 가능하다! (0) | 2024.03.12 |
---|---|
'javac'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다. (0) | 2023.03.02 |
오프라인 폐쇄망 가상화 서버에서 아파치 톰캣 mysql 소스설치 (0) | 2022.12.16 |
터미널로 자바 컴파일해서 실행해보기 (0) | 2022.09.19 |
패키지 이름을 바꾸고 싶었다 (feat.전자정부프레임워크 낱낱히 헤집어보기) (1) | 2022.09.16 |
댓글