Skip to content

datavaggio/lumio-vault

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lumio Vault

GitHub Workflow Status Maven Central Repository javadoc GitHub

A library providing DI with JSR-330 annotations and extensible YML/JSON configuration.

Implementations found in this package shouldn't be tied to any specific Lumio project.

Note: This library is considered as "in beta" and as such significant API changes may occur without prior warning.

I. Installation

Add the following in your pom.xml:

<dependency>
    <groupId>com.lumiomedical</groupId>
    <artifactId>lumio-vault</artifactId>
    <version>0.9.1</version>
</dependency>

II. Notes on Structure and Design

TODO

III. Usage

A basic example of using this library with a yml configuration file:

Given a dummy configuration file my_conf.yml:

variables:
    my_var: 12.34
    my_other_var: "interesting"
    my_env_var: ${MY_VAR}

services:
    my_service:
        class: "me.company.MyClass"
        constructor:
            - "not so interesting"
            - "##my_var##"

    my_other_service:
        class: "me.company.MyOtherClass"
        constructor:
            - "##my_other_var##"

We could perform injection via annotations on a dummy class such as:

public class MyService
{
    @Inject @Named("my_service")
    public MyClass service;
    @Inject @Named("my_other_service")
    public MyOtherClass otherService;
}

..and do the following:

MyService service = Vault.with("my_conf.yml").inject(new MyService());

..one of the neat things we can do, is programmatically override parts of the configuration:

MyService service = Vault.with("my_conf.yml", defs -> {
    defs.setVariable("my_var", 34.56); //my_var will now equal 34.56 upon injection
}).inject(new MyService());

Alternatively we could directly query one of the declared services:

MyClass myService = Vault.with("my_conf.yml").instance(Key.of(MyClass.class, "my_service"));

Other features that will need to be documented include:

  • import of dependency json/yml files
  • service method invocation
  • service instantiation via static method call
  • service aliasing
  • service closing
  • service container composition
  • custom modules

TODO

IV. Dev Installation

This project will require you to have the following:

  • Java 11+
  • Git (versioning)
  • Maven (dependency resolving, publishing and packaging)

About

A library providing dependency injection with JSR-330 annotations and extensible YML/JSON configuration

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%