Injecting configuration items in Java SE 8

Using injection mechanism of Java 8, configuration items can be injected into the application.

public class Config {

public int getConfiguration(InjectionPoint ip) {
String cls = ip.getMember().getDeclaringClass().getName();
String fieldName = ip.getMember.getName();
get the value of the fieldname from database of file or some other source
return value;

String myConfigItem;

int getMyIntConfigItem;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s