inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

Swagger Documentation 구현 - Spring Boot 2.7 사용 ①

swagger 오류

3868

kim1234123

작성한 질문수 53

1

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

pom.xml에 swagger관련 추가시

There are test failures.

Please refer to C:\Users\Owner\Desktop\RESTJPA\restjpa\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

이런 오류가 나고

또다른

dependency에 원래 코드로 작성하면

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>3.0.0</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>3.0.0</version>
</dependency>

 

http://localhost:8080/v2/api-docs로 접속하면

java.lang.TypeNotPresentException: Type javax.servlet.http.HttpServletRequest not present

오류가 뜹니다.

 

현재 버전 바뀌면서

javax ->jakarta로 변경된것 같은데 어떻게 해결하나요?

 

rest-api spring-boot

답변 1

0

Dowon Lee

안녕하세요, 이도원입니다.

작업하고 계신 Spring Boot의 버전이 2.7.x 이하인지 확인해 보실 수 있을까요? Spring Boot3로 작업하실 경우 Swagger가 정상적으로 작동하지 않을 수 있습니다. sprongfox swagger에서 아직 jakarta 패키지를 지원하지 않는 것 같습니다. Spring Boot의 버전과 Swagger의 버전을 확인해 보시고 다시 실행해 보시기 바랍니다. 최신 소스 코드는 아래 git에서 확인하실 수 있습니다.

https://github.com/joneconsulting/my-restful-services

Spring Boot 3.0으로 업그레이드 된 부분이 있는 만큼, 강의도 업데이트 해야 할 것 같네요. 조만간에 업데이트 하도록 하겠습니다.

감사합니다.

0

2_yewon

깃허브 막혔는데 혹시 코드 공유 가능하실까요?ㅜㅜ

0

Dowon Lee

안녕하세요, 이도원입니다.

해당 강의는 최신버전으로 최근에 업데이트 해서 다사 녹화하였습니다. 기존에 강의교안은 사용하실 수 없고, 아래 경로에서 새 강의소스 확인해 보실 수 있습니다.

https://github.com/joneconsulting/new-my-restful-service.git

감사합니다.

0

2_yewon

감사합니다!

JPA

0

57

1

jpa dependency를 추가하고 SecurityConfig클래스에서 오류가 납니다.

0

68

1

웹 브라우저 400 bad request

0

71

1

@Size는 되는데 @Past는 안 됩니다.

0

61

1

pdf 자료는 없나요?

0

73

2

locale 정보가 null 이면 무조건 messages_ko.properties이 호출 되는 문제

0

87

2

Swagger 강의, Unable to infer base url 이거 뜨시는 분들 도움되시라고

0

118

1

강의에서나온 화면 피피티

0

158

1

HelloWorldBean 관련 에러

0

183

2

Swagger API 3.x 오류..

0

219

1

java: variable message not initialized in the default constructor 에러는 어찌하면 좋을까요?

1

282

1

현재 GIT에 올리신 소스를 실행해봤습니다.

0

189

2

고양이 소리가 귀엽네요 !!

0

137

2

git에서 소스받고 실습중인데

0

117

1

post가 안되요

0

102

1

한국어 같은 경우 언어코드인 messages_ko.properties 로 생성하는게 더 좋지 않나요?

0

167

2

리턴타입으로서 EntityModel<User> 와 ResponseEntity질문

0

103

1

예외처리쪽 관련 질문있습니다.

0

159

2

엔티티가 바로 응답으로 나가도 되나요??

0

221

2

안녕하세여 Cannot invoke "co.kr.joneconsulting.resfulservice.repository.PostRepository.save(Object)" because "this.postRepository" is null

0

135

2

사용자 등록하고 나서 H2 에서 보면 신규 사용자의 password, ssn 이 null 로 되어 있습니다.

0

140

2

ApplictionContext 질문

0

192

2

롬북이 안먹히는것같아요

0

156

1

인텔리제이에서스프링부트 파일 실행하면

0

240

1