Created
June 1, 2020 03:47
-
-
Save ahwinemman/e92055ec17ae57365e47196fd63691ea to your computer and use it in GitHub Desktop.
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
package com.javaee.injectprops.configuration; | |
import com.javaee.injectprops.annotations.IntegerProperty; | |
import com.javaee.injectprops.annotations.StringProperty; | |
import javax.enterprise.context.ApplicationScoped; | |
import javax.enterprise.inject.Produces; | |
import javax.enterprise.inject.spi.InjectionPoint; | |
import javax.inject.Inject; | |
@ApplicationScoped | |
public class PropertyProvider { | |
@Inject | |
private ConfigurationManager configurationManager; | |
@Produces | |
@IntegerProperty | |
Integer getIntegerPropertyValue(InjectionPoint ip) { | |
return configurationManager.getIntegerProperty(ip.getAnnotated().getAnnotation(IntegerProperty.class).value()); | |
} | |
@Produces | |
@StringProperty | |
String getStringPropertyValue(InjectionPoint ip) { | |
return configurationManager.getStringProperty(ip.getAnnotated().getAnnotation(StringProperty.class).value()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment