Class ResourceBundleConstraintDescriptionResolver

java.lang.Object
org.springframework.restdocs.constraints.ResourceBundleConstraintDescriptionResolver
All Implemented Interfaces:
ConstraintDescriptionResolver

public class ResourceBundleConstraintDescriptionResolver extends Object implements ConstraintDescriptionResolver
A ConstraintDescriptionResolver that resolves constraint descriptions from a ResourceBundle. The resource bundle's keys are the name of the constraint with .description appended. For example, the key for the constraint named jakarta.validation.constraints.NotNull is jakarta.validation.constraints.NotNull.description.

Default descriptions are provided for all of Bean Validation 3.1's constraints:

Default descriptions are also provided for the following Hibernate Validator constraints:

Author:
Andy Wilkinson
  • Constructor Details

    • ResourceBundleConstraintDescriptionResolver

      public ResourceBundleConstraintDescriptionResolver()
      Creates a new ResourceBundleConstraintDescriptionResolver that will resolve descriptions by looking them up in a resource bundle with the base name org.springframework.restdocs.constraints.ConstraintDescriptions in the default locale loaded using the thread context class loader.
    • ResourceBundleConstraintDescriptionResolver

      public ResourceBundleConstraintDescriptionResolver(ResourceBundle resourceBundle)
      Creates a new ResourceBundleConstraintDescriptionResolver that will resolve descriptions by looking them up in the given resourceBundle.
      Parameters:
      resourceBundle - the resource bundle
  • Method Details