I have my application.yaml, f.e:
bookshop:
properties:
books:
maxSize:
title: 60
description: 800
price:
commonDiscount: 10
sale: true
Now I create 'getter-class' for getting this values with @Value
annotation:
@Getter
@Component
public class BookSettingsGetter {
@Value("${bookshop.properties.books.maxSize.title}")
private Integer titleMaxSize;
@Value("${bookshop.properties.books.maxSize.description}")
private Integer descriptionMaxSize;
@Value("${bookshop.properties.books.price.commonDiscount}")
private Integer commonDiscountPercent;
@Value("${bookshop.properties.books.sale}")
private Boolean allowSaleBooks;
}
But I want to make it with @ConfigurationProperties
. A common part of all values is bookshop.properties.books
and I can get easy only bookshop.properties.books.sale
.
How to get other properties with @ConfigurationProperties
in one class? It's possible?