java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0

今天使用feign进行远程调用,被调用方使用@RequestParam接受参数,但是在启动项目的时候报了错

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
===2018-08-13 17:25:37.606 ERROR org.springframework.boot.SpringApplication Line:771 - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'infoSheetController': Unsatisfied dependency expressed through field 'infoSheetService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'infoSheetServiceImpl': Unsatisfied dependency expressed through field 'infoSheetConsumer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'share.api.server.modular.consumer.InfoSheetConsumer': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at share.api.server.ApiServer.main(ApiServer.java:20)

原因是使用@RequestParam接收参数的时候,需要参数名,如下(id)

@RequestMapping("/selectSheetDetails")
    Map<String, Object> selectSheetDetails(@RequestParam("id") String id);
posted @ 2018-08-14 17:30  慢慢行  阅读(339)  评论(0编辑  收藏  举报