Is it possible to get own object from application.yaml and bind it with @Value to my component?
Model:
@Data
public class CurrencyPlan {
private
If you're looking to bind your properties to a class you can use @ConfigurationProperties
.
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-typesafe-configuration-properties
@ConfigurationProperties(prefix="plans.eur")
and
@Component
would be placed on the CurrencyPlan
. @EnableConfigurationProperties
preferably placed on an @Configuration
class.
After you can autowire the CurrencyPlan
class into the dependent classes.