title: Environment variable is always null. Kotlin Spring
body: <p>I am having trouble with environment variables in spring.
  I want to retrieve the name of the serviceAccount file, I will need this for my firestore db, depending on if my application is running on my prod, test or dev environment.</p>
  
  <p>Here is the application.yml file im working with - the environment variables are set in AWS.</p>
  
  <pre><code>spring:
   profiles: aws
  contentapi:
   apikey: ${APIKEY}
  firestore:
   serviceAccount: ${SDKPATH:serviceAccount_dev.json}
  </code></pre>
  
  <p>Here my default/fallback value is the dev serviceAccount</p>
  
  <p>I did read here on Stackoverflow that the @value variables isn't initialised before after the constructor is done.</p>
  
  <p>The problem is that I have to use the variable for my connection to my database..</p>
  
  <p>I have tried the @value annotation, System.env and all the other suggestions I could find here, but none worked.</p>
  
  <p>How do I solve this? It seems that the variable is always null..</p>
  
  <p>Here is my code  </p>
  
  <pre><code>@Configuration
  @Service
  class ArticleService {
  
  @Value("\${contentapi.apikey}")
  lateinit var contentapiKey:String
  
  @Value("\${firestore.serviceAccount}")
  lateinit var serviceAccount:String
  
  var articleIds = ArrayList&lt;String&gt;()
  var articleIdsNotSaved = ArrayList&lt;String&gt;()
  
  private val articleContentApi = "https://content.watchmedier.dk/api/jyllands-posten/content/article/"
  
  private val firebaseAdminSDK = this.javaClass.classLoader.getResourceAsStream(serviceAccount)
  
  private val options = FirebaseOptions.Builder()
          .setCredentials(GoogleCredentials.fromStream(firebaseAdminSDK))
          .setDatabaseUrl("https://myprojectid.firebaseio.com")
          .build()!!
  private val firestore = FirebaseApp.initializeApp(options)
  val databaseReference = FirestoreClient.getFirestore(firestore)
  
  
  fun fetchRecommendations( appId:String, siteName:String, max:String, context:String) {
  </code></pre>