inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

Swagger Documentation 구현 - Spring Boot 2.7 사용 ①

java: package springfox.documentation.spi does not exist 에러

1853

KimJeongMin

작성한 질문수 3

0

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</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>
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


@EnableSwagger2
@Configuration
public class SwaggerConfig {

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}

소스 코드는 위와 같이 작성했는데 서버를 재기동 하게되면 아래와 같은 에러코드가 송출됩니다..

java: package springfox.documentation.spi does not exist 

documenttation.sip가 없다고 나오는데 어떤점이 문제일까요? 

스프링부트 2.3.10 버전 사용중입니다 

spring-boot rest-api

답변 2

1

Dowon Lee

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

pom.xml 파일에 아래와 같은 dependecy를 추가하신 다음에 maven 빌드가 정상적으로 되었는지 확인해 보시기 바랍니다. 빌드가 정상적으로 되셨다면, IntelliJ IDEA > Proejct 윈도우 > External Libraries 에서 아래와 같은 내용을 확인해 보실 수 있습니다.

package springfox.documentation.spi does not exist  에러가 발생가, pom.xml 파일을 수정하신 후에, 빌드를 하지 않으셔서 적용되지 않은 것 같습니다. 참고로, springfox.documentation.spi 패키지는 springfox-boot-starter dependecy만 추가하셔도 됩니다. 

위 내용은 Spring boot <version>2.3.10.RELEASE</version>에서 확인 하였습니다. 

감사합니다.

0

KimJeongMin

해결했습니다. 
뭔가 꼬여있던거 같네요 

답변주신 내용처럼 설정 후에도 동일한 증생이 발생해서 프로젝트를 완전히 종료 후 재실행 하니까 lombok 관련 오류가 나길래 Build Automatically 활성화하고 재실행 해보니 해결 됐습니다 감사합니다!

JPA

0

71

1

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

0

84

1

웹 브라우저 400 bad request

0

84

1

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

0

76

1

pdf 자료는 없나요?

0

92

2

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

0

100

2

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

0

133

1

강의에서나온 화면 피피티

0

169

1

HelloWorldBean 관련 에러

0

194

2

Swagger API 3.x 오류..

0

230

1

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

1

288

1

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

0

203

2

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

0

149

2

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

0

127

1

post가 안되요

0

116

1

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

0

176

2

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

0

113

1

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

0

165

2

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

0

239

2

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

0

150

2

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

0

146

2

ApplictionContext 질문

0

199

2

롬북이 안먹히는것같아요

0

161

1

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

0

244

1