[Java] When checking URL format with Bean Validation, it may be better not to use @URL of Hibernate Validator.

The content is roughly as the title.

Reason

In the implementation of ʻorg.hibernate.validator.internal.constraintvalidators.hv.URLValidator, validation will pass even if you just enter " http: ". If the URL is limited to the URL, such as "Only protocols such as http/httpsshould be entered, at least the domain should be entered", use the@Pattern` annotation to make it regular You should check it with the expression.

Supplement

[Maven Repository: org \ .hibernate \ .validator »hibernate \ -validator» 6 \ .1 \ .2 \ .Final](https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator/6.1 I verified it with 2.Final).

Recommended Posts

[Java] When checking URL format with Bean Validation, it may be better not to use @URL of Hibernate Validator.
Things to be aware of when writing Java
Summary of how to use the proxy set in IE when connecting with Java
[Java] When var should be used and when it should not be used
[Java] Things to be aware of when outputting FizzBuzz
How to use trained model of tensorflow2.0 with Kotlin / Java
Things to be aware of when writing code in Java
Be sure to compare the result of Java compareTo with 0
Is it easy for the user to use when implementing general-purpose functions? Let's be aware of
[Bean Validation] When java.lang.Boolean is returned by a method starting with "is ~" Cannot be validated with AssertTrue / AssertFalse [Java]