title: This annotation is not applicable to target 'local variable
body: <p>I want to get value from application.yml, but I got &quot;This annotation is not applicable to target 'local variable&quot; for this part，how to solve this problem?</p>
  <pre><code>@Value(&quot;\${aws.secretsManager.secretName}&quot;)
  val secretName: String? = &quot;&quot;
  
  </code></pre>
  <pre><code>@Configuration
  @EnableConfigurationProperties
  @ConfigurationProperties
  
  fun getSecret() {
  
          @Value(&quot;\${aws.secretsManager.secretName}&quot;)
          val secretName: String? = &quot;&quot;
  
  
          val region = &quot;us-west-2&quot;
          val logger: Logger = LoggerFactory.getLogger(GetSecretConfig::class.java)
  
          // Create a Secrets Manager client
          val client = AWSSecretsManagerClientBuilder.standard().withRegion(region).build()
          val getSecretValueRequest = GetSecretValueRequest().withSecretId(secretName)
  
          var getSecretValueResult: GetSecretValueResult? = try {
              client.getSecretValue(getSecretValueRequest)
          } 
  }
  </code></pre>
  <p>application.yml</p>
  <pre><code>aws:
    secretsManager:
      secretName: &quot;test-mvp&quot;
      region: &quot;us-west-2&quot;
      user: &quot;root&quot;
      password: &quot;root&quot;
  </code></pre>