79649969

Date: 2025-06-02 16:03:48
Score: 1
Natty:
Report link

It's ugly, but I've confirmed this works with both SpringBoot 2.7.18 and SpringBoot 3.4.5.

(and despite what you may read elsewhere, it does work on abstract classes, as long as the @Validated and the validation constraint are both on the abstract class)

import org.springframework.validation.annotation.Validated;

@Validated
public abstract class AbstractJwksAutoConfig {

    @javax.validation.constraints.Min(60000L)
    @jakarta.validation.constraints.Min(60000L)
    @javax.validation.constraints.Max(86400000L)
    @jakarta.validation.constraints.Max(86400000L)
    Long jwksRefreshTimeInMillis = 180000L;

    ...
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Validated
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: dlipofsky