0

我有一个假客户:

@FeignClient(name="admit-card-service")
public interface CallFeignClient {
    
    @GetMapping("centers")
    public List<CenterInfo> getCenterList();
}

我打来的电话

@RestController
public class ClientController {
    
    @Autowired
    CallFeignClient callFeinClient;

    @GetMapping("clienCenters")
    public List<CenterInfo> getCenterLists(){
        return callFeinClient.getCenterList();
    }
}

但我收到以下错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.demo.client.CallFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1674) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1249) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1474) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1431) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1214) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 19 common frames omitted
Caused by: java.lang.NullPointerException: null
    at springfox.documentation.schema.property.field.FieldModelPropertyProvider.beanDescription(FieldModelPropertyProvider.java:141) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.property.field.FieldModelPropertyProvider.propertiesFor(FieldModelPropertyProvider.java:121) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.property.provider.DefaultModelPropertiesProvider.propertiesFor(DefaultModelPropertiesProvider.java:58) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.propertiesFor(ModelDependencyProvider.java:184) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.nonTrivialProperties(ModelDependencyProvider.java:132) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.resolvedPropertiesAndFields(ModelDependencyProvider.java:121) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.resolvedDependencies(ModelDependencyProvider.java:100) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.resolvedTypeParameters(ModelDependencyProvider.java:110) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.resolvedDependencies(ModelDependencyProvider.java:99) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.ModelDependencyProvider.dependentModels(ModelDependencyProvider.java:61) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.schema.DefaultModelProvider.dependencies(DefaultModelProvider.java:113) ~[springfox-schema-2.0.1.jar:2.0.1]
    at springfox.documentation.spring.web.scanners.ApiModelReader.populateDependencies(ApiModelReader.java:131) ~[springfox-spring-web-2.0.1.jar:2.0.1]
    at springfox.documentation.spring.web.scanners.ApiModelReader.read(ApiModelReader.java:75) ~[springfox-spring-web-2.0.1.jar:2.0.1]
4

0 回答 0