In my Spring Boot
application, I have a class that uses a value from the configuration file:
@Service
public class Cat{
@Value("${cat.maxAge}")
private int maxAge;
....
I like to add validation on the Min
and Max
values, so the app will fail if some wrong values are in the config file.
Trying to do so:
@Service
public class Cat{
@Value("${cat.maxAge}")
@Max(value=10)
private int maxAge;
....
And IntelliJ doesn't know what @Max
is and doesn't recognize any package to import for it.
Is there a way to do it?