Catching an error while Spring injects a value
I'm using Spring to inject a GCP Secret into a variable, using the following code:
@Value("\${secret_name:{}}")
private lateinit var secretValue: String
In my application.yaml file I map secret_name to GCP's Secret Manager to a secret that doesn't necessarily exist (depending on the environment).
If this secret doesn't exist I get the following error, while trying to run my application:
Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with...