Giter VIP home page Giter VIP logo

configuration-provider's Introduction

Configuration Provider

Service Provider Interface (SPI) to define configuration.

How it works

Provides an interface to allow custom implementations to define key/value configuration entries.

This allows a Service Loader to pick configuration from remote sources.

How to implement it

The custom configuration service provider has to implement the interface ConfigurationProvider. The dependency library can be found here

Implementation reference example

Add the dependency to your project.

Maven example:

<dependency>
    <groupId>com.signavio.workflow</groupId>
    <artifactId>config-provider</artifactId>
    <version>1.0.2</version>
</dependency>

Create a class that implements ConfigurationProvider and overrides the method Map<String, String> get().

src/main/java/com/signavio/workflow/config/ExampleConfigProvider.java

public class ExampleConfigProvider implements ConfigurationProvider {

  @Override
  public Map<String, String> get() {
    return Collections.unmodifiableMap(
        new HashMap<String, String>() {{
          put("effektif.mongodb.password", "test_password");
          put("key", "value");
        }});
  }
}

The service provider has to include a file under META-INF/services. The file name should be the fully qualified service name without any extension. Inside the file the provider has to specify the fully qualified implementation.

src/main/resources/META-INF/services/com.signavio.workflow.config.ConfigurationProvider

com.signavio.workflow.config.ExampleConfigProvider

How to deploy it

The generated implementation has to be packed as a jar file and copied under $TOMCAT_HOME/webapps/ROOT/lib directory.

After that, the application has to be restarted in order for the new configuration service to be applied.

configuration-provider's People

Contributors

adelolmo avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

configuration-provider's Issues

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.