Skip to content

@Reference check=false doesn't take effect #195

Closed

Description

@mycybyby

AbstractConfig中appendAnnotation方法中:
if (value != null && ! value.equals(method.getDefaultValue()))
因为check=false等于默认值,所以if里面的逻辑没有执行(setter方法没有被调用),导致AbstractReferenceConfig的check没有修改为false,还是null。
根本原因还是AbstractReferenceConfig中check的默认值是null,而@reference的默认值是false,修改方法要不把AbstractReferenceConfig的check改成false,要不把上面的判断去掉。

Activity

  1. kxyfyh commented on Mar 2, 2017

    @kxyfyh

    直接
    @reference
    中的默认值该为true 也能搞定吧

  2. liuanxin commented on Aug 29, 2017

    @liuanxin

    也就是所有 <值设置为 false> 的都将会被忽略 然后实际用到这个值的地方没有同时设置这个默认值.

    加这种 !value.equals(method.getDefaultValue()) 自做聪明的判断, 又不把后续处理的地方同步!

    单说这个问题, 目前看来只能在运行时加上 -Ddubbo.reference.check=false 这么处理了

  3. Comven commented on Sep 8, 2017

    @Comven

    @liuanxin 我在IDEA启动时加上-Ddubbo.reference.check=false 执行效果是一样的呢

  4. Comven commented on Sep 10, 2017

    @Comven

    目前测试到spring-boot-starter-dubbo项目必须设置consumer.check=false才行,这样一来变成了所有都不检查,虽然不是初衷,但是目前只能这样子了,还是希望官方修复下@reference注解

  5. AniFengx commented on Oct 9, 2017

    @AniFengx

    @Comven spring.dubbo.consumer.check=false 我添加这个配置并没有生效,他还是会所有都检测一遍,如果我希望消费方先于提供方启动有什么办法吗

  6. AniFengx commented on Oct 9, 2017

    @AniFengx

    @Comven 我用-Ddubbo.consumer.check=false这个之后就可以实现延迟加载服务了,但是感觉这样并不是一个好的办法

  7. ijaychang commented on Apr 16, 2018

    @ijaychang

    我是直接搞个spring-dubbo-consumer.xml
    用一个DubboConfig Java Config方式引入这个xml
    `@Configuration
    @ImportResource(locations = {"classpath:spring/spring-dubbo-consumer.xml"})
    public class DubboConfig {

    }

    配置文件里就一个配置

    <dubbo:consumer check="false"/>
    `

  8. added a commit that references this issue on Feb 24, 2019
  9. added this to the 2.7.1 milestone on Mar 4, 2019
  10. self-assigned this
    on Mar 5, 2019
  11. added a commit that references this issue on Mar 8, 2019
  12. changed the title [-]@Reference check=false不生效[/-] [+]@Reference check=false doesn't take effect[/+] on Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions