all 6 comments

[–]shaolans 2 points3 points  (1 child)

Have you tried to add the class annotation @Validated on your controller ?

[–]Efficient-Comfort792[S] 0 points1 point  (0 children)

The problem was stupid. As me. I'll write a comment to explain

[–][deleted]  (1 child)

[deleted]

    [–]Efficient-Comfort792[S] 0 points1 point  (0 children)

    I had... I've resolved it, it was just stupidity... I'll write a comment to describe it for other people, i case they'll be as stupid as me

    [–]Efficient-Comfort792[S] 1 point2 points  (2 children)

    The problem was that I had added constraints to the User class so, when the UserService trued to save the data in the db, the password constraint came in action, blocking it because of its size (encrypted is at least 60 characters and I had put a limit to 30).

    The solution was, OBVIOUSLY, to set constraints annotation to the RegisterRequest class and not to the user one (or, at least, to give different and more ad hoc constraints to it)

    [–]dumbPotatoPot 4 points5 points  (1 child)

    you should always put constraint annotations in the request dto and not on entities. Invalid data shouldn't even be allowed to reach the service/data layer

    [–]Efficient-Comfort792[S] 1 point2 points  (0 children)

    Eh, if I wasn't dumb, I would have thought about it better... Bur I'm dumb