feign异常: RequestParam.value() was empty on parameter 0

DiviceServiceFeign

    @FeignClient("mediatmsapi")
    public interface DiviceServiceFeign {
        @GetMapping("/divice/list")
        public List<TestDeviceBean> list(@RequestParam Map<String, Object> map);

        @PostMapping("/divice/add")
        public boolean add(TestDeviceBean testDeviceBean);

        @PostMapping("/divice/update")
        public boolean update(TestDeviceBean testDeviceBean);

        @GetMapping("/divice/remove")
        public boolean remove(@RequestParam Integer id);
    }

DiviceController

    @Controller
    public class DiviceController {
        @Autowired
        DiviceServiceFeign feign;

        @GetMapping("/v1/toDivicer")
        public String toDivicer(Model model) {
            return "tcmediaadmin/tms/upgradetestmanager/divicer";
        }

        @GetMapping("/divicer/getlist")
        @ResponseBody
        public List<TestDeviceBean> getlist(@RequestParam Map<String, Object> map) {
            return feign.list(map);
        }

        @PostMapping("/divicr/Divicradd")
        @ResponseBody
        public boolean Divicradd(TestDeviceBean testDeviceBean) {
            return feign.add(testDeviceBean);
        }

        @PostMapping("/divicr/Divicrupdate")
        @ResponseBody
        public boolean Divicrupdate(TestDeviceBean testDeviceBean) {
            return feign.update(testDeviceBean);
        }

        @GetMapping("/divicr/Divicrremove")
        public boolean Divicrremove(@RequestParam Integer id) {
            return feign.remove(id);
        }
    }

报错信息


    2020-11-06 15:37:04.161  ERROR 13236 --- [           main]  o.s.boot.SpringApplication - Application startup failed
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'diviceController': Unsatisfied dependency expressed through field 'feign'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cibnvideo.tmsscb.feign.DiviceServiceFeign': 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 com.cibnvideo.MediaAdminApplication.main(MediaAdminApplication.java:16)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cibnvideo.tmsscb.feign.DiviceServiceFeign': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
    	... 19 common frames omitted
    Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
    	at feign.Util.checkState(Util.java:128)
    	at org.springframework.cloud.netflix.feign.annotation.RequestParamParameterProcessor.processArgument(RequestParamParameterProcessor.java:63)
    	at org.springframework.cloud.netflix.feign.support.SpringMvcContract.processAnnotationsOnParameter(SpringMvcContract.java:238)
    	at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:107)
    	at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:133)
    	at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
    	at feign.hystrix.HystrixDelegatingContract.parseAndValidatateMetadata(HystrixDelegatingContract.java:34)
    	at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
    	at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
    	at feign.Feign$Builder.target(Feign.java:218)
    	at org.springframework.cloud.netflix.feign.HystrixTargeter.target(HystrixTargeter.java:56)
    	at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:145)
    	at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:166)
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
    	... 29 common frames omitted

@RequestParam 必须要声明value值吧我记得?

是的 太严格了 已经搞定