肇事接口如下

/**
     * get
     * @param vin
     * @return
     */
@RequestMapping(method = RequestMethod.GET, value = "/get")
TxxxGetDTO get(@RequestParam @NotBlank String vin);

代码本地启动没问题,但是jenkins发布到测试环境就启动报错

2023-06-12 15:24:05.612 ERROR --- [main] o.s.boot.SpringApplication : [] Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TxxxBindController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com..xx.dms.services.integration.UxxxFacadeFegin': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
        at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:321)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean0(AbstractBeanFactory.java:323)

解决方法

RequestParam 注解后面加上value,这个是Spring 4.0版本后,@RequestParam 注解对参数传值有了很好的封装特性并严格校验。

/**
     * get
     * @param vin
     * @return
     */
@RequestMapping(method = RequestMethod.GET, value = "/get")
TxxxGetDTO get(@RequestParam(value = "vin") @NotBlank String vin);
分类: java

0 条评论

发表评论

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注

站点统计

  • 文章总数:304 篇
  • 分类总数:19 个
  • 标签总数:189 个
  • 运行天数:852 天
  • 访问总数:460496 人次
ICP备案号: 辽ICP备20003309号