Error creating bean with name ‘objectMapperConfigurer‘ defined in class path resource

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘objectMapperConfigurer’ defined in class path resource [springfox/documentation/spring/web/SpringfoxWebMvcConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [springfox.documentation.spring.web.ObjectMapperConfigurer] from ClassLoader [sun.misc.Launcher A p p C l a s s L o a d e r @ 18 b 4 a a c 2 ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d o C r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 570 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . c r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 515 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . l a m b d a AppClassLoader@18b4aac2] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:570) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda AppClassLoader@18b4aac2]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:570) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 320 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 222 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 318 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 204 )   [ s p r i n g − b e a n s − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] 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 . r e g i s t e r B e a n 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 : 240 )   [ s p r i n g − c o n t e x t − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] 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 g i s t e r B e a n 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 : 721 )   [ s p r i n g − c o n t e x t − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] 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 : 534 )   [ s p r i n g − c o n t e x t − 5.1.6. R E L E A S E . j a r : 5.1.6. R E L E A S E ] 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 : 775 ) [ s p r i n g − b o o t − 2.1.4. R E L E A S E . j a r : 2.1.4. R E L E A S E ] 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 ) [ s p r i n g − b o o t − 2.1.4. R E L E A S E . j a r : 2.1.4. R E L E A S E ] 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 : 316 ) [ s p r i n g − b o o t − 2.1.4. R E L E A S E . j a r : 2.1.4. R E L E A S E ] 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 : 1260 ) [ s p r i n g − b o o t − 2.1.4. R E L E A S E . j a r : 2.1.4. R E L E A S E ] 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 : 1248 ) [ s p r i n g − b o o t − 2.1.4. R E L E A S E . j a r : 2.1.4. R E L E A S E ] a t c o m . z h o u b i n . m y b a t i s p l u s . M y b a t i s p l u s A p p l i c a t i o n . m a i n ( M y b a t i s p l u s A p p l i c a t i o n . j a v a : 12 ) [ c l a s s e s / : n a ] C a u s e d b y : j a v a . l a n g . I l l e g a l S t a t e E x c e p t i o n : F a i l e d t o i n t r o s p e c t C l a s s [ 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 . O b j e c t M a p p e r C o n f i g u r e r ] f r o m C l a s s L o a d e r [ s u n . m i s c . L a u n c h e r 0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:240) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:721) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:534) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE] at com.zhoubin.mybatisplus.MybatisplusApplication.main(MybatisplusApplication.java:12) [classes/:na] Caused by: java.lang.IllegalStateException: Failed to introspect Class [springfox.documentation.spring.web.ObjectMapperConfigurer] from ClassLoader [sun.misc.Launcher 0(AbstractBeanFactory.java:320) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) [springbeans5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:240) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:721) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:534) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)[springboot2.1.4.RELEASE.jar:2.1.4.RELEASE]atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)[springboot2.1.4.RELEASE.jar:2.1.4.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:316)[springboot2.1.4.RELEASE.jar:2.1.4.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1260)[springboot2.1.4.RELEASE.jar:2.1.4.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1248)[springboot2.1.4.RELEASE.jar:2.1.4.RELEASE]atcom.zhoubin.mybatisplus.MybatisplusApplication.main(MybatisplusApplication.java:12)[classes/:na]Causedby:java.lang.IllegalStateException:FailedtointrospectClass[springfox.documentation.spring.web.ObjectMapperConfigurer]fromClassLoader[sun.misc.LauncherAppClassLoader@18b4aac2]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:367) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:207) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:189) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:128) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:297) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1077) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:567) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
… 14 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_111]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_111]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_111]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
… 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_111]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_111]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_111]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_111]
… 25 common frames omitted

解决方案:
将pom.xml中的依赖1换成依赖2即可。

	    <!-- 依赖1 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        
      <!-- 依赖2 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java旅途

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值