I have the following problem:
I've wanted to read some values (the price of products) from .properties file.
However I'm trying, It's always getting 0.00 as a value.
This is my service bean, which in I want to create a product list:
@Service
@ConfigurationProperties(prefix = "product-service")
public class ProductService {
private double first;
private double second;
private double third;
public double getFirst() {
return first;
}
public void setFirst(double first) {
this.first = first;
}
public double getSecond() {
return second;
}
public void setSecond(double second) {
this.second = second;
}
public double getThird() {
return third;
}
public void setThird(double third) {
this.third = third;
}
private List<ProductDTO> productList = Arrays.asList(
new ProductDTO(1, "Tomb Raider", first),
new ProductDTO(2, "10000 rp to lol", second),
new ProductDTO(3, "2k valorant points", third)
);
public List<ProductDTO> findAllProducts() {
return productList;
}
}
And this is the property file:
product-service.first = 225.00
product-service.second = 320.50
product-service.third = 150.99