오류 발생
Spring boot에서 swagger를 사용하려고 build.gradle에 다음을 추가해줬다
dependencies {
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
}
그런데 서버를 실행하니 발생하는 오류
Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
[전문]
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-09-02 21:17:15.201 ERROR 16064 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:357) ~[spring-context-5.3.29.jar:5.3.29]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:156) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:124) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.29.jar:5.3.29]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.15.jar:2.7.15]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.15.jar:2.7.15]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.15.jar:2.7.15]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.15.jar:2.7.15]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.15.jar:2.7.15]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.15.jar:2.7.15]
at co m.springboot.api.ApiApplication.main(ApiApplication.java:10) ~[classes/:na]
찾아보니까 Spring boot 2.6버전 이후에
spring.mvc.pathmatch.matching-strategy 값이
ant_apth_matcher -> path_pattern_parser로 변경되었다고 한다
그래서 라이브러리 일부에서 오류가 발생한 것!
해결방법
application.properties 파일에 다음을 추가해준다.
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
결과
정상적으로 실행된다.
'Web Develop > Spring' 카테고리의 다른 글
[Spring JPA] ORM 그리고 Spring Data JPA (1) | 2023.11.22 |
---|---|
[Rest API] Spring JPA를 통한 CRUD 구현하기_SpringBoot (0) | 2023.10.25 |
[Rest API] 컨트롤러를 통한 게시판 기능 구현하기_SpringBoot (0) | 2023.10.25 |
스프링 프레임워크 (0) | 2023.06.17 |
댓글