1 Star 0 Fork 0

keking / quarkus-apollo-config

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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

Comments ( 0 )

Sign in for post a comment

About

quarkus集成apollo配置中心的框架扩展 spread retract
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
Java
1
https://git.oschina.net/kekingcn/quarkus-apollo-config.git
git@git.oschina.net:kekingcn/quarkus-apollo-config.git
kekingcn
quarkus-apollo-config
quarkus-apollo-config
master

Search

102255 3a0e046c 1850385 102255 7aaa926c 1850385