Code Monkey home page Code Monkey logo

hzero-config's Introduction

hzero-config

配置中心
-- Home Page --

Introduction

配置中心

Documentation

Features

  • 服务管理
  • 服务配置管理

Dependencies

  • 服务 maven 坐标
<dependency>
    <groupId>org.hzero</groupId>
    <artifactId>hzero-config</artifactId>
    <version>${hzero.service.version}</version>
</dependency>

Contributing

欢迎参与项目贡献!比如提交PR修复一个bug,或者新建Issue讨论新特性或者变更。

Copyright (c) 2020-present, HZERO

hzero-config's People

Watchers

 avatar

hzero-config's Issues

注册中心通过org.hzero.config.api.controller.v1.ConfigEndpoint#publish发布无法触发onChange时间

请求示例:
POST http://localhost:8010/config/publish
Content-Type: application/json

{
"serviceName": "hzero-admin",
"label": "default",
"fileType": "json",
"content": "{year:2021,month: 3}"
}

可能原因:
只有当propertiesMap 的大小大于0时,才触发onChange事件,但是下面对map的值类型判断不包含int类型,导致该map容量为0。
image

修改传参,值改为String类型

POST http://localhost:8010/config/publish
Content-Type: application/json

{"lable":"default",
"serviceName":"hzero-admin",
"fileType":"json",
"content":"{"month":"6","year":"2023"}"
}

可以进入到onChange方法,serviceConfig作为旧值map,configValue作为新值map。
但是在方法org.hzero.config.app.service.impl.ServiceConfigServiceImpl#onChange(java.lang.String, java.lang.String, java.util.Map<java.lang.String,java.lang.Object>, java.lang.String, java.lang.Object)前,把 serviceConfig设置成了最新值,导致了configValue和serviceConfig永远一致
这一步导致了bug,修改代码为:

 //注释掉更新方法,这一步导致时间无法被监听
           /* serviceConfig.setConfigValue(JSON.toJSONString(config));*/
            ServiceConfig copy = new ServiceConfig();
            BeanUtils.copyProperties(serviceConfig,copy);
            copy.setConfigValue(JSON.toJSONString(config));
            configRepository.updateByPrimaryKey(copy);

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.