Ok, I see. The current way of achieving this would be to leverage group conversions:
class Foo { @NotNull @Valid @ConvertGroup(from=Default.class, to=Foo.class) Bar bar; } class Bar { Integer value; @AssertTrue(groups=Foo.class) boolean hasValidValue() { return value.equals(42); } }
That way, the @AssertTrue constraint would only be validated when validating a Bar instance in the course of cascaded validation from Foo.