git-leon пре 5 година
родитељ
комит
7a0cb83508
1 измењених фајлова са 6 додато и 5 уклоњено
  1. 6
    5
      README.md

+ 6
- 5
README.md Прегледај датотеку

506
 
506
 
507
 
507
 
508
 
508
 
509
-## Part 5.4 - Validating domain entities
509
+## Part 5.5 - Validating domain entities
510
 
510
 
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.
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
   - `question` should be `@NotEmpty`
515
   - `question` should be `@NotEmpty`
516
 - To enforce these validations, add `@Valid` annotations to Poll objects in `RequestMapping`-annotated controller methods (there should be 2)
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
 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:
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
 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.
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
 - add below handler to `RestExceptionHandler`
530
 - add below handler to `RestExceptionHandler`
531
 
531
 
562
 - Use an autowired `MessageSource` object in the `RestExceptionHandler` to set the message on ValidationError objects (ie: `setMessage(messageSource.getMessage(fe,null));` )
562
 - Use an autowired `MessageSource` object in the `RestExceptionHandler` to set the message on ValidationError objects (ie: `setMessage(messageSource.getMessage(fe,null));` )
563
   - This object will be autowired (or injected) the same way your `CRUDRepository` instances are.
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
 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.
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
 ## Part 6.2 - Spring's Built-in Pagination
648
 ## Part 6.2 - Spring's Built-in Pagination
649
 
649
 
650
 * Make use of Spring's built-in page number pagination support by researching `org.springframework.data.repository.PagingAndSortingRepository`.
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
 * Send a `GET` request to `http://localhost:8080/polls?page=0&size=2` via Postman.
653
 * Send a `GET` request to `http://localhost:8080/polls?page=0&size=2` via Postman.
653
 * Ensure the response is a `JSON` object with pagination-specific information.
654
 * Ensure the response is a `JSON` object with pagination-specific information.