具体错误:

[main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [springfox.boot.starter.autoconfigure.OpenApiAutoConfiguration]; nested exception is java.io.FileNotFoundException: class path resource [springfox/documentation/spring/web/SpringfoxWebConfiguration.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:609)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:310)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599)
at org.springframework.context.annotation.ConfigurationClassParser.access 800 ( C o n f i g u r a t i o n C l a s s P a r s e r . j a v a : 110 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P a r s e r 800(ConfigurationClassParser.java:110) at org.springframework.context.annotation.ConfigurationClassParser 800(ConfigurationClassParser.java:110)atorg.springframework.context.annotation.ConfigurationClassParserDeferredImportSelectorGroupingHandler.lambda$processGroupImports 1 ( C o n f i g u r a t i o n C l a s s P a r s e r . j a v a : 811 ) a t j a v a . u t i l . A r r a y L i s t . f o r E a c h ( A r r a y L i s t . j a v a : 1259 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P a r s e r 1(ConfigurationClassParser.java:811) at java.util.ArrayList.forEach(ArrayList.java:1259) at org.springframework.context.annotation.ConfigurationClassParser 1(ConfigurationClassParser.java:811)atjava.util.ArrayList.forEach(ArrayList.java:1259)atorg.springframework.context.annotation.ConfigurationClassParserDeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:808)
at org.springframework.context.annotation.ConfigurationClassParser D e f e r r e d I m p o r t S e l e c t o r H a n d l e r . p r o c e s s ( C o n f i g u r a t i o n C l a s s P a r s e r . j a v a : 779 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P a r s e r . p a r s e ( C o n f i g u r a t i o n C l a s s P a r s e r . j a v a : 192 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P o s t P r o c e s s o r . p r o c e s s C o n f i g B e a n D e f i n i t i o n s ( C o n f i g u r a t i o n C l a s s P o s t P r o c e s s o r . j a v a : 319 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P o s t P r o c e s s o r . p o s t P r o c e s s B e a n D e f i n i t i o n R e g i s t r y ( C o n f i g u r a t i o n C l a s s P o s t P r o c e s s o r . j a v a : 236 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . P o s t P r o c e s s o r R e g i s t r a t i o n D e l e g a t e . i n v o k e B e a n D e f i n i t i o n R e g i s t r y P o s t P r o c e s s o r s ( P o s t P r o c e s s o r R e g i s t r a t i o n D e l e g a t e . j a v a : 275 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . P o s t P r o c e s s o r R e g i s t r a t i o n D e l e g a t e . i n v o k e B e a n F a c t o r y P o s t P r o c e s s o r s ( P o s t P r o c e s s o r R e g i s t r a t i o n D e l e g a t e . j a v a : 95 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . i n v o k e B e a n F a c t o r y P o s t P r o c e s s o r s ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 706 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 532 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . w e b . s e r v l e t . c o n t e x t . S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . r e f r e s h ( S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . j a v a : 141 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h ( S p r i n g A p p l i c a t i o n . j a v a : 747 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h C o n t e x t ( S p r i n g A p p l i c a t i o n . j a v a : 397 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 315 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1226 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1215 ) a t c o m . v i t o . A p p . m a i n ( A p p . j a v a : 25 ) C a u s e d b y : j a v a . i o . F i l e N o t F o u n d E x c e p t i o n : c l a s s p a t h r e s o u r c e [ s p r i n g f o x / d o c u m e n t a t i o n / s p r i n g / w e b / S p r i n g f o x W e b C o n f i g u r a t i o n . c l a s s ] c a n n o t b e o p e n e d b e c a u s e i t d o e s n o t e x i s t a t o r g . s p r i n g f r a m e w o r k . c o r e . i o . C l a s s P a t h R e s o u r c e . g e t I n p u t S t r e a m ( C l a s s P a t h R e s o u r c e . j a v a : 180 ) a t o r g . s p r i n g f r a m e w o r k . c o r e . t y p e . c l a s s r e a d i n g . S i m p l e M e t a d a t a R e a d e r . g e t C l a s s R e a d e r ( S i m p l e M e t a d a t a R e a d e r . j a v a : 56 ) a t o r g . s p r i n g f r a m e w o r k . c o r e . t y p e . c l a s s r e a d i n g . S i m p l e M e t a d a t a R e a d e r . < i n i t > ( S i m p l e M e t a d a t a R e a d e r . j a v a : 50 ) a t o r g . s p r i n g f r a m e w o r k . c o r e . t y p e . c l a s s r e a d i n g . S i m p l e M e t a d a t a R e a d e r F a c t o r y . g e t M e t a d a t a R e a d e r ( S i m p l e M e t a d a t a R e a d e r F a c t o r y . j a v a : 103 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . t y p e . c l a s s r e a d i n g . C o n c u r r e n t R e f e r e n c e C a c h i n g M e t a d a t a R e a d e r F a c t o r y . c r e a t e M e t a d a t a R e a d e r ( C o n c u r r e n t R e f e r e n c e C a c h i n g M e t a d a t a R e a d e r F a c t o r y . j a v a : 86 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . t y p e . c l a s s r e a d i n g . C o n c u r r e n t R e f e r e n c e C a c h i n g M e t a d a t a R e a d e r F a c t o r y . g e t M e t a d a t a R e a d e r ( C o n c u r r e n t R e f e r e n c e C a c h i n g M e t a d a t a R e a d e r F a c t o r y . j a v a : 73 ) a t o r g . s p r i n g f r a m e w o r k . c o r e . t y p e . c l a s s r e a d i n g . S i m p l e M e t a d a t a R e a d e r F a c t o r y . g e t M e t a d a t a R e a d e r ( S i m p l e M e t a d a t a R e a d e r F a c t o r y . j a v a : 81 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P a r s e r . a s S o u r c e C l a s s ( C o n f i g u r a t i o n C l a s s P a r s e r . j a v a : 695 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . a n n o t a t i o n . C o n f i g u r a t i o n C l a s s P a r s e r DeferredImportSelectorHandler.process(ConfigurationClassParser.java:779) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:192) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) 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:706) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at com.vito.App.main(App.java:25) Caused by: java.io.FileNotFoundException: class path resource [springfox/documentation/spring/web/SpringfoxWebConfiguration.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.getClassReader(SimpleMetadataReader.java:56) at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50) 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.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:695) at org.springframework.context.annotation.ConfigurationClassParser DeferredImportSelectorHandler.process(ConfigurationClassParser.java:779)atorg.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:192)atorg.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319)atorg.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)atorg.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)atorg.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)atorg.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:315)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1226)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1215)atcom.vito.App.main(App.java:25)Causedby:java.io.FileNotFoundException:classpathresource[springfox/documentation/spring/web/SpringfoxWebConfiguration.class]cannotbeopenedbecauseitdoesnotexistatorg.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)atorg.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:56)atorg.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)atorg.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)atorg.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)atorg.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)atorg.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)atorg.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:695)atorg.springframework.context.annotation.ConfigurationClassParserSourceClass.getRelated(ConfigurationClassParser.java:1093)
at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getAnnotationAttributes(ConfigurationClassParser.java:1074)
at org.springframework.context.annotation.ConfigurationClassParser.collectImports(ConfigurationClassParser.java:548)
at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:521)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:310)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599)
… 22 common frames omitted

解决办法:

再配置文件添加生产环境关闭swagger配置:
在这里插入图片描述

springfox:
  documentation:
    # 总开关(同时设置auto-startup=false,否则/v3/api-docs等接口仍能继续访问)
    enabled: false
    auto-startup: false
    swagger-ui:
      enabled: false
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐