GithubHelp home page GithubHelp logo

stalet / cdi-config Goto Github PK

View Code? Open in Web Editor NEW

This project forked from piotrnowicki/cdi-config

0.0 3.0 0.0 90 KB

CDI Config module that allows you to inject property files values directly into your Java classes.

cdi-config's Introduction

CDI-Config

CDI Config module that allows you to inject property files values directly into your Java classes.

Exemplary usage

By adding the product of this project (a regular *.jar file) into your WEB-INF/lib directory, you can use following syntax for injecting property files entries into your Java code:

public MyClass {

    @Inject
    @ConfigurationValue("keyValue")
    Double myDoubleProp;
    
    ...
}

It will scan all *.properties files directly in your classpath root directory and look for a property with key: keyValue.

Required dependency

You can specify that the property must be defined in order to satisfy the dependency using required attribute (true by default):

@Inject
@ConfigurationValue(value="keyValue", required=false)
String urlPath;

Default property key

If you won't specify the property key, it will try to find a key which is a fully qualified field name. If this doesn't work out - it fallback to the injected field name. E.g. for such definition:

package eu.awaketech;

public MyClass {

    @Inject
    @ConfigurationValue
    String myName;
}

it will try to find property with eu.awaketech.MyClass.myName key. If it won't be found, it'll try with myName. If this also fails - because of default required=true, it will throw an unmet CD Idependency exception.

Requirements

This module was written in Java SE 7 and uses its features, so it's required to work on or using it. It also uses Maven 3 and TestNG with Arquillian for unit and integration tests purpose.

cdi-config's People

Contributors

piotrnowicki avatar

Watchers

 avatar  avatar  avatar

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.