Hi!
Thank you for your question.
Due to the design of the validator mechanism, all of them are declared as prototype
spring bean.
First of all, this is necessary in order to have access to spring beans in the business logic of validators.
You are right that the ZipValidator
from the documentation has no obvious reason to be a spring bean.
However, the validator creation mechanism uses a factory to create validator components. This factory creates all validators as prototype
spring beans. This is why the validator from the documentation is a spring bean. Not only to comply with the concept.
If you try to use this validator in a standard workflow, but make it a regular Java class that is not a spring bean, you will get an error.
Best regards,
Dmitriy