Skip to content

lightweight support for binding environment variables and properties into your guice module

License

Notifications You must be signed in to change notification settings

mikesmit/guice-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

guice-environment

A lightweight library for binding environment variables and properties into your guice module

Properties

Import a set of properties as named string providers

PropModule propModule = PropModule.prefixAll("coderberryprops.", properties);

public class MyModule extends AbstractModule{
    @Override
    protected void configure(){
        install(propModule);
    }
    
    @Provides
    public Whatever provide(@Named("coderberryprops.propertyName") property) {
    ...
    }
}

Import a specific subset of properties

PropModule module = PropModule.builder()
        .prefix("coderberryprops.", "propertyName1", "propertyName2")
        .rename("propertyName3", "coderBerryProps.bucketName")
        .build();

Environment Variables

Import a specific subset of environment variables.

EnvModule envModule = EnvModule.builder()
    .prefix("coderberryenv.", "ENV_VARIABLE1", "ENV_VARIABLE2")
    .rename("ENV_VARIABLE3", "coderBerryEnv.bucketName")
    .build();

public class MyModule extends AbstractModule{
    @Override
    protected void configure(){
        install(envModule);
    }

    @Provides
    public Whatever provide(
            @Named("coderberryenv.ENV_VARIABLE1") value1,
            @Named("coderBerryEnv.bucketName") bucketName
    ) {
    ...
    }
}

About

lightweight support for binding environment variables and properties into your guice module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages