Przeglądaj źródła

Update 'README.md'

git-leon 5 lat temu
rodzic
commit
7a0cb83508
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6
    5
      README.md

+ 6
- 5
README.md Wyświetl plik

@@ -506,7 +506,7 @@ public ResponseEntity<?> handleResourceNotFoundException(ResourceNotFoundExcepti
506 506
 
507 507
 
508 508
 
509
-## Part 5.4 - Validating domain entities
509
+## Part 5.5 - Validating domain entities
510 510
 
511 511
 Now it's time to make sure that all objects persisted to the database actually contain valid values. Use the `org.hibernate.validator.constraints.NotEmpty` and `javax.validation.constraints.Size` and `javax.validation.Valid` annotations for validation.
512 512
 
@@ -515,7 +515,7 @@ Now it's time to make sure that all objects persisted to the database actually c
515 515
   - `question` should be `@NotEmpty`
516 516
 - To enforce these validations, add `@Valid` annotations to Poll objects in `RequestMapping`-annotated controller methods (there should be 2)
517 517
 
518
-## Part 5.5 - Customizing validation errors
518
+## Part 5.6 - Customizing validation errors
519 519
 
520 520
 In order to customize validation errors we'll need a class for error information. Create a `ValidationError` class in `io.zipcoder.tc_spring_poll_application.dto.error` with the following fields and appropriate getters and setters:
521 521
 
@@ -525,7 +525,7 @@ In order to customize validation errors we'll need a class for error information
525 525
 We also need a new field in the `ErrorDetail` class to hold errors. There may be multiple validation errors associated with a request, sometimes more than one of the same type, so this field will be a collection, specifically a `Map<String, List<ValidationError>> errors` field.
526 526
 
527 527
 
528
-## Part 5.6 - Create a validation error handler
528
+## Part 5.7 - Create a validation error handler
529 529
 
530 530
 - add below handler to `RestExceptionHandler`
531 531
 
@@ -562,7 +562,7 @@ for(FieldError fe : fieldErrors) {
562 562
 - Use an autowired `MessageSource` object in the `RestExceptionHandler` to set the message on ValidationError objects (ie: `setMessage(messageSource.getMessage(fe,null));` )
563 563
   - This object will be autowired (or injected) the same way your `CRUDRepository` instances are.
564 564
 
565
-## Part 5.7 - Externalize strings in a messages.properties file
565
+## Part 5.8 - Externalize strings in a messages.properties file
566 566
 
567 567
 Commonly used strings in your Java program can be removed from the source code and placed in a separate file. This is called externalizing, and is useful for allowing changes to text displayed without impacting actual program logic. One example of where this is done is in internationalization, the practice of providing multilingual support in an application, allowing users to use an application in their native language.
568 568
 
@@ -648,6 +648,7 @@ Size.poll.options=Options must be greater than {2} and less than {1}
648 648
 ## Part 6.2 - Spring's Built-in Pagination
649 649
 
650 650
 * Make use of Spring's built-in page number pagination support by researching `org.springframework.data.repository.PagingAndSortingRepository`.
651
-* Modify respective `Controller` methods to handle `Pageable` arguments.
651
+* Modify respective `Controller` methods to handle `Pageable` arguments and `Page<T>` return-types.
652
+* Modify respective `Repository` methods to handle `Page<T>` objects.
652 653
 * Send a `GET` request to `http://localhost:8080/polls?page=0&size=2` via Postman.
653 654
 * Ensure the response is a `JSON` object with pagination-specific information.