Created
July 17, 2013 07:38
-
-
Save Qkyrie/6018505 to your computer and use it in GitHub Desktop.
ConfigValue annotation for automatically injecting configuration strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
import javax.enterprise.util.Nonbinding; | |
import javax.inject.Qualifier; | |
@Qualifier | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) | |
public @interface ConfigValue { | |
// Excludes this value from being considered for injection point matching | |
@Nonbinding | |
// Avoid specifying a default value, since it can encourage programmer error. | |
// We WANT a value every time. | |
String value(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment