Declaring Twitter credentials for the Spring container

Let's produce our Twitter configuration objects. As a pattern we have been using, we will use the @Configuration class for that. The class should be as follows:

package springfive.twittergathering.infra.twitterimport org.springframework.beans.factory.annotation.Valueimport org.springframework.context.annotation.Beanimport org.springframework.context.annotation.Configuration@Configurationopen class TwitterConfiguration(@Value("\${twitter.consumer-key}") private val consumerKey: String,                                @Value("\${twitter.consumer-secret}") private val consumerSecret: String,                                @Value("\${twitter.access-token}") private val accessToken: String,                                @Value("\${twitter.access-token-secret}") private val accessTokenSecret ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.