Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Accessing Grails Configuration with Spring Property Placeholders
package com.objectpartners.application.config
config {
social {
twitter {
consumerKey = "ABCD"
consumerSecret = "EFGH"
accessToken = "IJKL"
accessTokenSecret = "MNOP"
}
faceboook {
...
}
linkedin {
...
}
}
}
class TwitterService {
@Value('${config.social.twitter.consumerKey}')
private String consumerKey
@Value('${config.social.twitter.consumerSecret}')
private String consumerSecret
@Value('${config.social.twitter.accessToken}')
private String accessToken
@Value('${config.social.twitter.accessTokenSecret}')
private String accessTokenSecret
TwitterTemplate createTwitterTemplate() {
new TwitterTemplate(consumerKey, consumerSecret, accessToken, accessTokenSecret)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.