我正在尝试使用Spring inside Spring Boot实现开放式API文档和开放式API UI:
我指的是以下指南:https://www.baeldung.com/spring-rest-openapi-documentation
maven中的依赖项如下所示:
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-core -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-core</artifactId>
<version>1.1.49</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.20</version>
</dependency>
我使用的Spring Boot版本是2.2
我在通过运行应用程序时遇到以下与元数据相关的错误/mvnw spring启动:运行
java.lang.IllegalStateException: Unable to read meta-data for class org.springdoc.core.MultipleOpenApiSupportConfiguration
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:233) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getOrder(AutoConfigurationSorter.java:204) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.access$000(AutoConfigurationSorter.java:150) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationSorter.lambda$getInPriorityOrder$0(AutoConfigurationSorter.java:63) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:360) ~[na:na]
at java.base/java.util.TimSort.sort(TimSort.java:234) ~[na:na]
at java.base/java.util.Arrays.sort(Arrays.java:1516) ~[na:na]
你知道为什么会这样吗?
我也有同样的问题,这里是完整的堆栈跟踪:
24-12-2019 15:51:45.312 [restartedMain] ERROR o.s.boot.SpringApplication.reportFailure - Application run failed
java.lang.IllegalStateException: Unable to read meta-data for class org.springdoc.core.MultipleOpenApiSupportConfiguration
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:233)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getOrder(AutoConfigurationSorter.java:204)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.access$000(AutoConfigurationSorter.java:150)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter.lambda$getInPriorityOrder$0(AutoConfigurationSorter.java:62)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.util.TimSort.sort(TimSort.java:234)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1462)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:61)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.sortAutoConfigurations(AutoConfigurationImportSelector.java:430)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.selectImports(AutoConfigurationImportSelector.java:415)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:878)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202)
at com.test.server.Application.main(Application.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.io.FileNotFoundException: class path resource [org/springdoc/core/MultipleOpenApiSupportConfiguration.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:51)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:229)
... 32 common frames omitted
问题在于springdoc openapi核心
和springdoc openapi ui
库的版本不兼容。我已通过为这两个依赖项设置1.1.49版本进行了修复:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-core</artifactId>
<version>1.1.49</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.1.49</version>
</dependency>
springdoc openapi ui
将springdoc openapi核心
作为可传递的依赖项。最安全的做法是只定义最深的依赖项,并让它提取其上游库的正确版本,如下所示:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-openapi-ui.version}</version>
</dependency>
换句话说,从POM依赖项中删除springdoc-openapi-core
,只指定上述内容(当然,用您想要的版本替换${springdoc-openapi-ui.version}
)。
我的代码出错了,我不知道为什么。我正在使用OpenCsv库,并试图将我的Csv保存到一个数组中。CSV的列看起来像:日期、售出、代码,然后在它下面的信息像:1123,may4,0021;3323; 我的代码是: 错误是在 CSV 阅读器 csvreader = 新的 CSVReader(读取器);线。
我在写一个程序,它应该接受一堆tiff的,并把它们放在一起。我让它对我读入的大多数图像文件都起作用,但当我尝试读入它们时,它们中的一大部分会抛出一个错误。 是的,我捕捉到了越界异常,所以我们不用担心这个。我的问题是我得到以下错误: iIOException:读取图像元数据时出现I/O错误!在com.sun.media.imageioimpl.plugins.tiff.tiffimagereader
本文向大家介绍SpringBoot使用validation-api实现参数校验的示例,包括了SpringBoot使用validation-api实现参数校验的示例的使用技巧和注意事项,需要的朋友参考一下 我们在开发Java项目的时候,经常需要对参数进行一些必填项、格式、长度等进行校验,如果手写代码对参数校验,每个接口会需要很多低级的代码,这样会降低代码的可读性。那么我们能不能使用一种比较优雅的方式
我目前正在为我正在制作的一款游戏进行单元测试,但在maven身上遇到了一个奇怪的错误,我无法理解。 我已经运行了,现在我的测试失败了。 以下是我在运行mvn测试-X时遇到的错误: 这是我的Maven文件: 这是JUnit测试的代码: 下面是我得到错误的代码: 我很确定它与maven文件有关,但我不确定它是什么。也许是我正在使用的图像阅读库?任何帮助都将不胜感激。
首先,我很抱歉我的英语,我希望你能理解。这是我的第一个android应用程序,我尝试使用Firebase进行身份验证和数据库。身份验证工作正常,但我不能读写实时数据库。以下是我的数据库规则和结构: 我试图将数据库中的数据添加到reclyclerview中,但我的代码止步于AddValueEventListener。然后我尝试添加一个简单的数据到数据库,但它也不起作用。我也尝试将相同的代码放入一个活
使用SXSSFWorkbook读取Excel,1W行数据,188列(测试时只有前16列有数据) 读取操作完成后,JVM中存在大量的org.apache.xmlbeans.impl.store.Xobj$AttrXobj org.apache.xmlbeans.impl.store.Xobj$ElementXob类的实例,很长时间内不会被GC 我尝试过使用SAX事件驱动解析Excel、Streami