Share Attribute Validation Annotation between different Models

Viewed 10

I have multiple Models with the same attribute, for example: CustomerNumber it hast to be always 10 digits long, it is now in the Model of Customer, CustomerContract, CustomerContactData, Entity and Restmodels.

I am looking for a possibility to define the Attribute validation only once.

I am using Springboot and Kotlin. ( Value Classes do not work because Spring ignores init and anotations of them on RestController )

0 Answers
Related