prosource

스프링 데이터 저장 시 'documentationPluginsBootstrapper'를 시작하지 못했습니다.

probook 2023. 3. 9. 22:09
반응형

스프링 데이터 저장 시 'documentationPluginsBootstrapper'를 시작하지 못했습니다.

어플리케이션에 spring data rest를 사용하고 있습니다.

저장소에 이 메서드를 추가하면 다음 오류가 발생하고 응용 프로그램이 시작되지 않습니다.-

방법:-

@Modifying
@Transactional
@Query("from employee as ft where ft.company.id = ?1")
void deleteAllEmployeeCompany(
        @Param("companyId") @RequestParam("companyId") int companyId);

오류:-

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:874) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]

어떻게 해결할 것인가?

갱신일 : -

모든 의존관계 목록:-

[INFO] com.test:test-service:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile
[INFO] |  |     +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  |     |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] |  |     +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |     \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.4.1.RELEASE:compile
[INFO] |     \- org.springframework:spring-context:jar:4.3.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.1.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-aop:jar:4.3.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.5:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.5:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.3.3.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.0.11.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.0.11.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.10.3.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.12.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-orm:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.3.RELEASE:compile
[INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.3.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-rest:jar:1.4.1.RELEASE:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:compile
[INFO] |  \- org.springframework.data:spring-data-rest-webmvc:jar:2.5.3.RELEASE:compile
[INFO] |     \- org.springframework.data:spring-data-rest-core:jar:2.5.3.RELEASE:compile
[INFO] |        \- org.atteo:evo-inflector:jar:1.2.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.5:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.5:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.5:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.3.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:4.3.3.RELEASE:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-eureka:jar:1.1.0.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:1.1.0.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:1.1.0.RELEASE:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:4.1.3.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-commons:jar:1.1.0.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.1.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.47:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.47:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-core:jar:1.1.0.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:1.1.0.RELEASE:compile
[INFO] |  +- com.netflix.eureka:eureka-client:jar:1.4.6:compile
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.3.7:runtime
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:runtime
[INFO] |  |  +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:runtime
[INFO] |  |  +- com.netflix.archaius:archaius-core:jar:0.7.4:compile
[INFO] |  |  +- javax.ws.rs:jsr311-api:jar:1.1.1:runtime
[INFO] |  |  +- com.netflix.servo:servo-core:jar:0.10.1:runtime
[INFO] |  |  |  \- com.netflix.servo:servo-internal:jar:0.10.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-core:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey:jersey-client:jar:1.19.1:runtime
[INFO] |  |  +- com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.1:runtime
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] |  |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[INFO] |  |  |  \- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  |  +- com.google.inject:guice:jar:4.0:runtime
[INFO] |  |  |  +- javax.inject:javax.inject:jar:1:runtime
[INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:runtime
[INFO] |  |  \- com.netflix.governator:governator-api:jar:1.12.10:runtime
[INFO] |  +- com.netflix.eureka:eureka-core:jar:1.4.6:compile
[INFO] |  |  +- com.amazonaws:aws-java-sdk-core:jar:1.10.30:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-ec2:jar:1.10.30:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.9.3:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-sts:jar:1.9.3:runtime
[INFO] |  |  +- com.amazonaws:aws-java-sdk-route53:jar:1.9.3:runtime
[INFO] |  |  +- com.netflix.governator:governator:jar:1.12.10:runtime
[INFO] |  |  |  +- com.netflix.governator:governator-core:jar:1.12.10:runtime
[INFO] |  |  |  \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:runtime
[INFO] |  |     +- javax.xml.stream:stax-api:jar:1.0-2:runtime
[INFO] |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.4:runtime
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-archaius:jar:1.1.0.RELEASE:compile
[INFO] |  |  \- commons-configuration:commons-configuration:jar:1.8:compile
[INFO] |  |     +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |     \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.1.0.RELEASE:compile
[INFO] |  |  +- com.netflix.ribbon:ribbon:jar:2.1.5:compile
[INFO] |  |  |  +- com.netflix.ribbon:ribbon-transport:jar:2.1.5:runtime
[INFO] |  |  |  |  +- io.reactivex:rxnetty-contexts:jar:0.4.9:runtime
[INFO] |  |  |  |  \- io.reactivex:rxnetty-servo:jar:0.4.9:runtime
[INFO] |  |  |  \- io.reactivex:rxnetty:jar:0.4.9:runtime
[INFO] |  |  |     +- io.netty:netty-codec-http:jar:4.0.27.Final:runtime
[INFO] |  |  |     |  +- io.netty:netty-codec:jar:4.0.27.Final:runtime
[INFO] |  |  |     |  \- io.netty:netty-handler:jar:4.0.27.Final:runtime
[INFO] |  |  |     \- io.netty:netty-transport-native-epoll:jar:4.0.27.Final:runtime
[INFO] |  |  |        +- io.netty:netty-common:jar:4.0.27.Final:runtime
[INFO] |  |  |        +- io.netty:netty-buffer:jar:4.0.27.Final:runtime
[INFO] |  |  |        \- io.netty:netty-transport:jar:4.0.27.Final:runtime
[INFO] |  |  +- com.netflix.ribbon:ribbon-core:jar:2.1.5:compile
[INFO] |  |  +- com.netflix.ribbon:ribbon-httpclient:jar:2.1.5:compile
[INFO] |  |  |  \- com.netflix.netflix-commons:netflix-commons-util:jar:0.1.1:runtime
[INFO] |  |  +- com.netflix.ribbon:ribbon-loadbalancer:jar:2.1.5:compile
[INFO] |  |  |  \- com.netflix.netflix-commons:netflix-statistics:jar:0.1.1:runtime
[INFO] |  |  \- io.reactivex:rxjava:jar:1.1.5:compile
[INFO] |  +- com.netflix.ribbon:ribbon-eureka:jar:2.1.5:compile
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.4.2:compile
[INFO] |     +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |     \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-messaging:jar:4.3.3.RELEASE:compile
[INFO] |  \- org.springframework.amqp:spring-rabbit:jar:1.6.2.RELEASE:compile
[INFO] |     +- com.rabbitmq:amqp-client:jar:3.6.3:compile
[INFO] |     +- org.springframework.retry:spring-retry:jar:1.1.4.RELEASE:compile
[INFO] |     +- com.rabbitmq:http-client:jar:1.0.0.RELEASE:compile
[INFO] |     \- org.springframework.amqp:spring-amqp:jar:1.6.2.RELEASE:compile
[INFO] +- com.netflix.hystrix:hystrix-javanica:jar:1.3.16:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  +- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |  +- com.google.guava:guava:jar:18.0:compile
[INFO] |  +- com.netflix.hystrix:hystrix-core:jar:1.5.2:compile
[INFO] |  |  \- org.hdrhistogram:HdrHistogram:jar:2.1.7:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- com.netflix.hystrix:hystrix-metrics-event-stream:jar:1.3.16:compile
[INFO] |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
[INFO] +- io.springfox:springfox-swagger2:jar:2.6.0:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.10:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.10:compile
[INFO] |  +- io.springfox:springfox-spi:jar:2.6.0:compile
[INFO] |  |  \- io.springfox:springfox-core:jar:2.6.0:compile
[INFO] |  +- io.springfox:springfox-schema:jar:2.6.0:compile
[INFO] |  +- io.springfox:springfox-swagger-common:jar:2.6.0:compile
[INFO] |  +- io.springfox:springfox-spring-web:jar:2.6.0:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] |  \- org.mapstruct:mapstruct:jar:1.0.0.Final:compile
[INFO] +- io.springfox:springfox-swagger-ui:jar:2.6.0:compile
[INFO] +- io.springfox:springfox-data-rest:jar:2.6.0:compile
[INFO] |  \- org.springframework.hateoas:spring-hateoas:jar:0.20.0.RELEASE:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.5.1:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.34:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.4.1.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.4.1.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.1.RELEASE:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:2.5.0:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] |  |  \- org.json:json:jar:20140107:test
[INFO] |  +- org.springframework:spring-core:jar:4.3.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-test:jar:4.3.3.RELEASE:test
[INFO] +- com.jayway.jsonpath:json-path:jar:2.2.0:compile
[INFO] |  \- net.minidev:json-smart:jar:2.2.1:compile
[INFO] |     \- net.minidev:accessors-smart:jar:1.1:compile
[INFO] \- org.reflections:reflections:jar:0.9.10:compile
[INFO]    +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO]    \- com.google.code.findbugs:annotations:jar:2.0.1:compile

springfox-swagger2와 springfox-swagger-ui 버전(3.0.0), spring-boot 버전(2.6.2)을 사용하여 동일한 문제를 발생시켰습니다.

이 문제를 해결하는 방법은 응용 프로그램에 경로 매처를 추가하는 것입니다.속성 또는 application.yml

application.properties:

spring.mvc.pathmatch.path-match= ANT_PATH_MATCHER

application.yml:

spring:
    mvc:
      pathmatch:
            matching-strategy: ant_path_matcher

는 이 this음 this this this음음음음 。Spring Fox 3.0.0Spring MVC에 대한 새로운 PathPattern 기반 경로 매칭 전략을 지원하지 않습니다.이거는 이제 새로운 디폴트입니다.spring-boot 2.6.0.

실제로 이 문제에 대한 다음과 같은 몇 가지 해결 방법이 있습니다.

  1. spring-boot2.6.0 이전 버전으로 돌아갑니다.오래된 버전의 spring boot/spring 프레임워크(log4shell이나 CVE-2022-22965 등)의 주요 보안 문제 때문에 권장하지 않습니다.
  2. @santhanam에서 설명한 바와 같이 경로 패턴을 다시 AntPatternMatching으로 변경합니다.
  3. SpringFox1년 정도 갱신되지 않았기 때문에 프로젝트에서 완전히 삭제하고 유지관리된 springdoc-openapi 라이브러리로 교체하고 싶습니다.에 섹션이 있습니다.springdoc에서 SpringFox굉장히 쉽게 할 수 있어요.봄여우

내가 발견한 것은 봄은 기본적으로 mvcmatchers를 사용한다는 것이다. 왜냐하면 봄은 개미매처를 사용하기 때문에 우리는 이것을 해결할 수 있기 때문이다.

A

application.properties에서 antmatcher를 구성하도록 스프링을 변경합니다.

spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER

B

봄에 mvcmatcher를 활성화하여 swagger에 사용할 구성 파일 생성

  1. 원하는 장소에서 swagger 구성용 파일을 만듭니다.
  2. 이 주석을 달다.
@EnableWebMvc
@EnableSwagger2
@Component
public class SwaggersConfigs {
}

C

@EnableWebMvc 주석을 스프링 부트 복제의 메인 클래스 위에 배치하여 모든 스프링 애플리케이션에서 mvcmatcher를 활성화합니다.


@EnableWebMvc
@EnableSwagger2
@SpringBootApplication
public class SwaggerDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SwaggerDemoApplication.class, args);
    }

}

D

다른 코멘트에 기재되어 있는 오래된 버전을 사용한다.

springfox-swagger2springfox-swagger-ui의 springfox-swagger-ui swack spring boot version을 2.6.0에서 2.5.2로 전환하여 동일한 문제를 해결했습니다.

이전 버전으로 롤백하는 것이 문제를 해결하는 가장 좋은 방법은 아니라는 것을 알지만 지금은 도움이 되었습니다.

이 기능은 Springboot 버전 2.6.0 이상에서는 swagger 2를 지원하지 않습니다.springfox 및 swagger 2 종속성을 제거합니다.대신 springdoc-openapi-ui 의존관계를 추가합니다.

    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.6.6</version>
    </dependency>

이것을 application.properties 파일에 추가합니다.

spring.mvc.pathmatch.path-match= ANT_PATH_MATCHER

그런 다음 http://localhost:8080/http-ui/index.http:/localhost:8080으로 이동합니다.

이건 내게 효과가 있었다.

에러의 원인은 swagger와 spring-boot입니다.버전이 일치하지 않습니다.

다른 모든 종속성을 제거하고 아래의 종속성만 포함합니다.

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

아래 구성 추가:

application.properties의 경우

spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER

application.yml의 경우

spring:
    mvc:
      pathmatch:
            matching-strategy: ant_path_matcher

스프링 부트 버전 1.5.3에서도 같은 문제가 발생했습니다.릴리스. 단, guava 버전 20.0을 추가하여 해결할 수 있습니다.

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>20.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
    </dependency>

이 솔루션은 다음 속성과 함께 문제를 해결했습니다.

spring.mvc.pathmatch.spring-path=ant_path_matcher

스프링 부츠 2.6.6을 사용하고 있습니다.

Spring-Boot 2.6.0 및 SpringFox 3.0.0 문제가 패스매처인 경우 아래 속성을 사용하여 패스머치를 설정할 수 있으며 이 문제는 해결됩니다.

  spring:
        mvc:
          pathmatch:
                matching-strategy: ant_path_matcher

「 」의 에, 「 」의 설정도 합니다.matching-strategy다른 답변에서 언급했듯이, 저는 이것을 극복하기 위해 아래의 콩을 추가해야 했습니다.

@Bean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
    List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
    Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
    allEndpoints.addAll(webEndpoints);
    allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
    allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
    String basePath = webEndpointProperties.getBasePath();
    EndpointMapping endpointMapping = new EndpointMapping(basePath);
    boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
    return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
}


private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
    return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
}

솔루션은 여기에 있습니다.

회피책은 springfox-2.5.0으로 롤백하는 것입니다.

공식 문서에 따르면 아래 속성을 yaml로 추가하면 문제가 해결되었습니다.

springfox:
  documentation:
    auto-startup: false

오래된 swagger 의존관계 및 설정 클래스를 삭제합니다.새로운 springdoc 의존성을 사용하면

    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.6.4</version>
    </dependency>

이 구성을 application.properties에 추가합니다.

spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER

또는 yaml 파일 application.yml을 사용하는 경우

spring:
mvc:
  pathmatch:
        matching-strategy: ant_path_matcher

그런 다음 응용 프로그램을 실행합니다.

기본 패키지 이름 중 하나를 편집해야 합니다.스크린샷에 나와 있는 것처럼 나의 기본 패키지 이름. 나의 패키지 이름.

@Configuration
@EnableSwagger2
public class SwaggerConfig2 {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .apiInfo(new ApiInfoBuilder()
                        .title("Swagger Super")
                        .description("Swagger Description details")
                        .version("1.0").build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.swagger.controller"))
                .paths(PathSelectors.any()).build();
    }
}

또는

@Configuration
@EnableSwagger2
public class SwaggerConfig2 {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .apiInfo(new ApiInfoBuilder()
                        .title("Swagger Super")
                        .description("Swagger Description details")
                        .version("1.0").build())
                .select()
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .paths(PathSelectors.any()).build();
    }
}

그리고 스웨거 의존관계는

         <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.6.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.6.1</version>
            <scope>compile</scope>
        </dependency>

잘 되고 있어요

또한 다음과 같이 개별적으로 정의할 수 있습니다.

@Configuration
@EnableSwagger2
public class Swagger2UiConfiguration {
    @Bean
    public Docket api() {
        return (new Docket(DocumentationType.SWAGGER_2)).apiInfo(this.apiInfo()).select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).paths(PathSelectors.any()).build();
    }

    private ApiInfo apiInfo() {
        return (new ApiInfoBuilder()).title("Swagger API").version("1.0").description("Swagger is Awesome").build();
    }
}

주의: 일반적으로 스냅샷, M1, M2, M3, M4 릴리즈는 진행 중입니다.스프링 팀이 아직 작업 중이므로 사용하지 않는 것이 좋습니다.

주의: springdoc-open을 구현하는 경우새로운 버전의 spring-boot 3용 API는 다음과 같은 의존관계를 사용합니다.이 특정 버전은 스프링 부트 3에서 동작합니다.

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.0.2</version>
        </dependency>

비슷한 문제가 발생했는데 Springboot 2.6.0 / Spring fox 3 - documentation Plugins Bootstrapper를 실행한 후 해결되었습니다.

spring 2.6.1과 springfox-path2 2.9.2를 사용하고 있었습니다.「 application . properties """""" spring . mvc . path match . path - matcher 」

Spring-Boot 2.6.2 문제가 pathmatcher이므로 application.properties 파일에서 아래 속성을 사용하여 pathmach를 설정할 수 있습니다.이 문제는 해결됩니다.

"spring.mvc.pathmatch.spring-match=ANT_PATH_MATCHER"

SwaggerConfig에 @EnableWebMvc를 데코레이터로 추가해서 문제가 해결되었습니다.

@EnableWebMvc
public class SwaggerConfig {}

버전: Sprint 2.6.1 및 springfox-swagger* 2.9.2

이 문제는 컨트롤러 액션에 인수를 전달하려고 하는 것 같습니다(컨트롤러에서는 다음과 같이 주석을 달았습니다).RestController)는 해결되지 않았습니다.

예.

@ResponseBody
@PostMapping(value = "/foo")
com.bestbuy.checkout.domain.Order foo(
    Bar justSomeObject
) {

https://github.com/springfox/springfox/issues/2616 솔루션과 같이 최근에 추가한 상추 라이브러리에 제외를 추가해 보았는데 현재 정상적으로 동작하고 있습니다.springfox guava 의존증만 나타날 것입니다.이 질문에서는 다음과 같은 것이 유효합니다.

<dependency>
    <groupId>com.netflix.hystrix</groupId>
    <artifactId>hystrix-javanica</artifactId>
    <version>1.3.16</version>
        <exclusions>
            <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
            </exclusion>
        </exclusions>
</dependency>

나도 그래들 때 그런 문제가 있었어.springfox 서브의존관계에서 guava 의존관계를 모두 삭제하여 해결했습니다.

implementation('io.springfox:springfox-spi:2.9.2') {
    exclude group: 'com.google.guava', module: 'guava'
}

implementation('io.springfox:springfox-schema:2.9.2') {
    exclude group: 'com.google.guava', module: 'guava'
}

implementation('io.springfox:springfox-spring-web:2.9.2') {
    exclude group: 'com.google.guava', module: 'guava'
}

및 guava를 개별적으로 구현했습니다.

implementation('com.google.guava:guava:28.1-jre')

스프링 부트 버전:

2.5.0-SNAP샷

프로젝트의 버전을 줄인 것이 도움이 되었습니다.처음에는 spring 2.6.0을 사용하고 있었는데 2.5.2로 이동해서 문제가 해결되었습니다.

일반적인 이유는 스프링 부트버전 관리로 인해 요청 경로와 스프링 MVC 처리 매핑을 대조하는 기본 전략이 antpathmatcher에서 pathpatternparser로 변경되었기 때문입니다.이 문제는 properties.yml을 편집하여

spring: mvc: pathmatch: matching-path: ant_path_matcher

스프링 부츠 2.6을 사용하고 있고 spring fox-swagger를 사용하려고 하면 곤란합니다.

swagger 문서를 작성하려는 경우 이 종속성을 사용하십시오.

implementation 'org.springdoc:springdoc-openapi-ui:1.6.4'

다음 방법으로 액세스할 수 있는 문서가 생성됩니다./v3/api-docsswag-ui는 다음 방법으로 접근할 수 있습니다./swagger-ui/index.html

이게 도움이 됐으면 좋겠네요.

쿼리를 다음으로 변경합니다.

@Modifying
@Transactional
@Query("from employee as ft where ft.company.id = :companyId")
void deleteAllEmployeeCompany(
        @Param("companyId") @RequestParam("companyId") int companyId);

또는 SpEL을 사용하는 경우

@Modifying
@Transactional
@Query("from employee as ft where ft.company.id = ?#{companyId}")
void deleteAllEmployeeCompany(
        @Param("companyId") @RequestParam("companyId") int companyId);

https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions 를 체크해 주세요.

난 밀코스 서비스 환경을 가지고 있어 그리고 난 그들 모두에게 으스대고 있었어같은 문제가 있었습니다.솔루션 @ Santhanam은 1개를 제외한 모든 서비스에 효과가 있었습니다.서비스는spring-boot-starter-actuator하면 문제가됩니다.츠요시

이 「」라고 됩니다.spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER 는 스프링 액추에이터 자동 생성 경로에 영향을 주지 않습니다.

하거나 Spring Actuator를 입니다.ANT_PATH_MATCHER매칭 스트래티지로서

나는 그 문제를 쉽게 해결했다.Spinifex는 최신 버전이 아닙니다.자세한 내용은 이 링크를 클릭해 주세요.현재는 spring-doc을 사용하여 spring-fox 의존관계를 다음과 같은 의존관계로 바꿀 수 있습니다.

<dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-ui</artifactId>
      <version>1.6.8</version>
</dependency>

then add also this beans :
@Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .group("springshop-public")
                .pathsToMatch("/public/**")
                .build();
    }
    @Bean
    public GroupedOpenApi adminApi() {
        return GroupedOpenApi.builder()
                .group("springshop-admin")
                .pathsToMatch("/**")
                .build();
    }

스프링을 변경하여 스프링 부트 프로젝트의 application.properties에서 antmatcher를 구성합니다.

spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER

2.7.6 버전의 스프링 부츠를 사용하고 있는데 같은 에러가 발생하고 있습니다.그래서 솔루션을 찾아서 확인했습니다.bean 'documentation Plugins Bootstrapper'를 시작하지 못했습니다.– springdoc-openapi-ui를 사용합니다.

pom.xml 파일에 openapi 의존관계를 추가했습니다.

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.6.9</version>
</dependency>

또한 matching-strategy를 application.preperties 또는 application.yml 파일에 추가.

spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER

Springboot 버전을 2.6.0에서 2.5.4로 다운그레이드하면 문제가 해결됩니다(다음 스웨거 버전).

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

언급URL : https://stackoverflow.com/questions/40241843/failed-to-start-bean-documentationpluginsbootstrapper-in-spring-data-rest

반응형