4

If I have a base class like this

public class ValidDemo {

@Size(min = 1, max = 100)
private String field1;

@Size(min = 1, max = 100)
private String field2;

@Size(min = 1, max = 100)
private String field3;

@Size(min = 1, max = 100)
private String field4;

@NotNull
@Size(min = 1, max = 100)
private String field5;

}

And I use Spring Bean validation against 10,000 instances it runs really fast, about 150 ms. But if I then have a class that extends ValidDemo and validate 10,000 instances it is taking about 10 times as long even though the extended class has no additional attributes, validation, etc.

Why is the performance so poor for derived classes?

0 Answers0