1 Star 1 Fork 1

keking / quarkus-apollo-config

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

quarkus-apollo-config

Apollo configuration center's quarkus framework extension

Quick start

  • 1、Introduce maven coordinates
            <dependency>
                <groupId>org.github.keking</groupId>
                <artifactId>quarkus-apollo-config-ext</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>
  • 2、Add the following configuration in the application.properties file
#apollo
quarkus.apollo.config=true
quarkus.apollo.config.namespace=application,service

By default, the switch of apollo extension is turned off, and you need to use the quarkus.apollo.config configuration to manually turn it on. For other usages of apollo configuration usage, refer to the official documentation

Quarkus Config Use

  • 1、How to configure the class
@ConfigProperties(prefix = "quarkus.app")
public class QuarkusConfig {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
  • 2、Property injection method
@Singleton
@Startup
public class ConfigService {

    @ConfigProperty(name = "quarkus.app.name")
    String appName;
    
    public void print(){
        System.out.println(appName);
    }
}
  • 3、Api manual acquisition method
@Singleton
@Startup
public class ConfigService {

    public void print(){
        Config config = ConfigProvider.getConfig();
        System.out.println(config.getValue("quarkus.app.name",String.class));
    }
}

Other resources

空文件

简介

quarkus集成apollo配置中心的框架扩展 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/kekingcn/quarkus-apollo-config.git
git@gitee.com:kekingcn/quarkus-apollo-config.git
kekingcn
quarkus-apollo-config
quarkus-apollo-config
master

搜索帮助