Procházet zdrojové kódy

Update 'README.md'

git-leon před 5 roky
rodič
revize
d5ac3273fc
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. 5
    3
      README.md

+ 5
- 3
README.md Zobrazit soubor

532
 ```java
532
 ```java
533
 @ExceptionHandler(MethodArgumentNotValidException.class)
533
 @ExceptionHandler(MethodArgumentNotValidException.class)
534
 public ResponseEntity<?>
534
 public ResponseEntity<?>
535
-handleValidationError(  MethodArgumentNotValidException manve,
535
+handleValidationError(MethodArgumentNotValidException manve,
536
 						HttpServletRequest request){...}
536
 						HttpServletRequest request){...}
537
 ```
537
 ```
538
 
538
 
559
 }
559
 }
560
 ```
560
 ```
561
 
561
 
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.
564
+
562
 ## Part 5.7 - Externalize strings in a messages.properties file
565
 ## Part 5.7 - Externalize strings in a messages.properties file
563
 
566
 
564
 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
 - Create a `messages.properties` file in the `src/main/resources` directory with the given properties below
571
 - Create a `messages.properties` file in the `src/main/resources` directory with the given properties below
569
   - `messages.properties` is a key-value file stored in plain text. Your IDE may have a table-based view or show the contents as text
572
   - `messages.properties` is a key-value file stored in plain text. Your IDE may have a table-based view or show the contents as text
570
   - `.properties` files are a common idiom in Java applications; they contain additional information the application uses that doesn't impact the actual source code.
573
   - `.properties` files are a common idiom in Java applications; they contain additional information the application uses that doesn't impact the actual source code.
571
-- Use an autowired `MessageSource` object in the `RestExceptionHandler` to set the message on ValidationError objects (ie: `setMessage(messageSource.getMessage(fe,null));` )
572
-  - This object will be autowired (or injected) the same way your `CRUDRepository` instances are.
574
+
573
 
575
 
574
 **`messages.properties` content**:
576
 **`messages.properties` content**:
575
 
577