【问题标题】:Springdoc-ui + GraalVM native @Configuration classes issueSpringdoc-ui + GraalVM 原生 @Configuration 类问题
【发布时间】:2020-12-21 07:31:52
【问题描述】:

为了了解 GraalVM + SpringBoot 的详细信息,我正在开发一个示例应用程序,其中只有一小部分操作和功能。 其中之一是公开 SpringDoc 端点的可能性(当前使用版本 1.4.5)。 即使应用程序已正确编译并且本机映像可执行文件启动,它也会在开始配置内容时引发异常:

org.springframework.beans.factory.BeanDefinitionStoreException: @Configuration classes need to be marked as proxyBeanMethods=false. Found: [org.springdoc.core.SpringDocConfigProperties, org.springdoc.core.SpringDocConfiguration, org.springdoc.core.SwaggerUiConfigParameters, org.springdoc.core.SwaggerUiConfigProperties, org.springdoc.core.SwaggerUiOAuthProperties, org.springdoc.webmvc.core.SpringDocWebMvcConfiguration, org.springdoc.webmvc.ui.SwaggerConfig]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:71) ~[poc-graalvm-native.exe:na]

我已经有以下依赖:

    implementation("org.springframework.experimental:spring-graalvm-native:0.7.1")
    implementation("org.springframework.boot:spring-boot-configuration-processor")
    annotationProcessor("org.springframework:spring-context-indexer:5.2.4.RELEASE")

在我的主课上还有@SpringBootApplication(proxyBeanMethods = false)

对于这些没有 proxyBeanMethods=false 属性的 @Configuration 类情况,是否有任何解决方法?

更新: 似乎在 Springdoc 1.4.6-Snapshot 上更新了配置。然而,其他的事情开始抱怨:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modelConverterRegistrar' defined in class path resource [org/springdoc/core/SpringDocConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springdoc.core.converters.ModelConverterRegistrar]: Factory method 'modelConverterRegistrar' threw exception; nested exception is java.lang.NullPointerException

不知道现在该去哪里......

【问题讨论】:

    标签: spring-boot graalvm springdoc graalvm-native-image springdoc-openapi-ui


    【解决方案1】:

    由于v1.5.9springdoc-openapi fully supports GraalVM 和 spring-native。

    无需额外配置。

    【讨论】:

    • 再次感谢您的回复。我现在使用的是 1.4.6 版本,您之前指出的更正已经出现在我的原生映像配置中。但我仍然有我的问题中提到的最后一个错误。
    猜你喜欢
    • 2013-05-28
    • 2011-02-20
    • 1970-01-01
    • 2022-06-14
    • 2020-12-07
    • 2020-09-09
    • 1970-01-01
    • 2022-12-14
    • 2020-10-25
    相关资源
    最近更新 更多