Last active
January 23, 2023 08:05
-
-
Save neilherbertuk/4d700c30ce05fa69cb8b3b630d42aeac to your computer and use it in GitHub Desktop.
An example of how to retrieve values from OpenIAM's PropertyValueCache - https://neilherbert.uk/2023/01/avoiding-hardcoded-values-in-openiam-groovy-scripts/
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 org.apache.commons.logging.Log | |
import org.apache.commons.logging.LogFactory | |
import org.openiam.idm.srvc.property.service.PropertyValueCache | |
import org.springframework.context.ApplicationContext | |
// Dependencies | |
Log log = LogFactory.getLog("propertValueExample") // Logging | |
ApplicationContext appContext = (ApplicationContext) context // IoC Container | |
PropertyValueCache propertyValueCache = appContext.getBean(PropertyValueCache.class) // Global Settings | |
log.info("Getting Value from PropertyValueCache") | |
String value = propertyValueCache.getString("uk.neilherbert.openiam.name") ?: "Not Found" | |
log.info("${value}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment