读取配置中心更新后数据抛出异常
来源:互联网 发布:java string.replace 编辑:程序博客网 时间:2024/06/15 03:16
在*****ScheduleImpl中定义属性,如下所示 备注: @AutoUpdate为公司内部注解
@Value("${batch.size:300}")@AutoUpdate@Getter@Setterprivate Integer batchSize;
当配置中心修改值后,程序抛出异常,如下
2017-09-29 16:25:16.012 [TxId : , SpanId : ] [ERROR] | clc-ums-config-manager-_-dev-_-default-thread-1 | | c.z.c.c.a.r.DefaultConfigUpdater:103 | Invalid property 'batchSize' of bean class [com.sun.proxy.$Proxy221]: Bean property 'batchSize' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?org.springframework.beans.NotWritablePropertyException: Invalid property 'batchSize' of bean class [com.sun.proxy.$Proxy221]: Bean property 'batchSize' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243) at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:437) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:292) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:260) at com.zhubajie.configcenter.client.spring.SpringAutoUpdateListener.updateAttrs(SpringAutoUpdateListener.java:70) at com.zhubajie.configcenter.client.spring.SpringAutoUpdateListener.onChanged(SpringAutoUpdateListener.java:56) at com.zhubajie.configcenter.client.api.runtime.DefaultConfigUpdater.triggerListener(DefaultConfigUpdater.java:309) at com.zhubajie.configcenter.client.api.runtime.DefaultConfigUpdater.checkLocalConfigUpdate(DefaultConfigUpdater.java:171) at com.zhubajie.configcenter.client.api.runtime.DefaultConfigUpdater$2.run(DefaultConfigUpdater.java:101) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
是因为公司配置中心不支持Dubbo提供者中直接通过属性方式注入,那么我们提供公共配置中心key读取Service即可,如下
import com.zhubajie.***;import lombok.Getter;import lombok.Setter;import org.springframework.beans.factory.annotation.Value;import org.springframework.stereotype.Component;@Setter@Getter@Componentpublic AutoService { @AutoUpdate private Integer batchSize;}
阅读全文
0 0
- 读取配置中心更新后数据抛出异常
- Vue.js 数据更新后,视图不会更新的异常
- 继承后方法抛出异常的问题
- java 方法超过执行时间后抛出异常
- C++程序抛出异常后执行顺序
- spring配置hibernate抛出read only 异常
- opencl:C++接口配置抛出异常
- SpringCloud配置中心客户端读取配置
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 抛出异常
- 深度学习入门
- 内部类总结
- flume使用之flume+hive 实现日志离线收集、分析
- 访问控制符
- Ubuntu 下安装Source Insight
- 读取配置中心更新后数据抛出异常
- Hive(上)--Hive介绍及部署
- 抽象工厂模式
- 词向量源码解析:(6.4)fasttext源码解析之文本分类3
- tcpdump介绍
- Xshell配置Xagent登陆服务器
- php数据导入到Excel中
- java中的==、equals()、hashCode()源码分析
- 【Outlook】2013 outlook working offline