I wrote an e mail program. But I had to change the some configs, so in my project I need to know how to read from yaml for my loginUrl
my code below;
userNotificationEmail.setIsActive("F");
userNotificationEmailRepository.save(userNotificationEmail);
activationResultType.setResultCode(ActivationResultCode.SUCCESSFUL);
activationResultType.setUser(userMapper.fromUser(userEntity));
activationResultType.setLoginUrl(loginUrl);
return activationResultType;
If your key is loginUrl (inside your yaml file), you can inject its value with the @Value annotation, inside a Spring component.
@Value("${loginUrl}")
private String loginUrl;
If it's a second level property, the path is @Value("${yourFirstKey.loginUrl}").
More documentation about reading YAML files with Spring Boot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With