-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
链式调用时为未初始化值或无默认值导致NPE问题(如果配置类为做新版本兼容配置项) #223
Comments
2.5.6测试,至少需要配置一个globalOperationParameters |
我希望是,如果简单项目或新手可以不配置该选项,至少能启动会比较好,给予默认值或者基本的初始化,所以我认为这是一个BUG |
llin6025
added a commit
to llin6025/spring-boot-starter-swagger
that referenced
this issue
Nov 18, 2021
dyc87112
added a commit
that referenced
this issue
Dec 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如项目中未配置
NPE
堆栈信息:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createSpringFoxRestApi' defined in class path resource [com/spring4all/swagger/DocketConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [void]: Factory method 'createSpringFoxRestApi' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
... 34 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [void]: Factory method 'createSpringFoxRestApi' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 49 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.spring4all.swagger.DocketConfiguration.getRequestParameters(DocketConfiguration.java:153)
at com.spring4all.swagger.DocketConfiguration.assemblyRequestParameters(DocketConfiguration.java:175)
at com.spring4all.swagger.DocketConfiguration.createSpringFoxRestApi(DocketConfiguration.java:79)
at com.spring4all.swagger.DocketConfiguration$$EnhancerBySpringCGLIB$$25e37900.CGLIB$createSpringFoxRestApi$1()
at com.spring4all.swagger.DocketConfiguration$$EnhancerBySpringCGLIB$$25e37900$$FastClassBySpringCGLIB$$3cd76e23.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.spring4all.swagger.DocketConfiguration$$EnhancerBySpringCGLIB$$25e37900.createSpringFoxRestApi()
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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 50 common frames omitted
The text was updated successfully, but these errors were encountered: