Jul 4, 2024
application.yaml
or application.properties
) and utilize it in the code.Move API Key to Configuration File:
resources/application.yaml
(or .properties
).weather.api.key: your_api_key_here
or
weather.api.key=your_api_key_here
**Using the API Key in Code: **
@Value
annotation to inject the API key in your class.
@Value("${weather.api.key}")
private String apiKey;
@Value
annotation with ${}
and correct property name.Null API Key Issue:
${weather.api.key}
is correct.static
modifier.MongoDB Whitelist Error: