# Lưu ý
1. Swagger document
Thay thế spring-fox bằng
```xmlhttps://hackmd.io/new
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.9</version>
</dependency>
```
Xem thêm về chuyển đổi từ spring-fox sang spring-doc: https://springdoc.org/#migrating-from-springfox
Link vào swagger ui: http://localhost:8080/swagger-ui.html
Link vào swagger: http://localhost:8080/v3/api-docs
2. Hal
```xml
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-explorer</artifactId>
</dependency>
```
4. Validation
Thay thế javax.validation bằng
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
```
5. H2 JPA
Thêm vào file `application.properties`
```
spring.jpa.show-sql=true
spring.h2.console.enabled=true
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=sa
```
Vào h2-console(http://localhost:8080/h2-console) lưu ý thay đổi
- URL: jdbc:h2:mem:db
- Username: sa
- Password: sa
6. Hateoas
Trong video họ dùng class Resource để hateoas, để hoạt động với spring mới sử dụng class EntityModel để thay thế.
Thay thế code trong video bằng
```java
@GetMapping("/users/{id}")
public EntityModel<User> retrieveUser(@PathVariable int id) {
User user = service.findOne(id);
if(user==null)
throw new UserNotFoundException("id-"+ id);
EntityModel<User> resource = EntityModel.of(user);
WebMvcLinkBuilder linkTo =
linkTo(methodOn(this.getClass()).retrieveAllUsers());
resource.add(linkTo.withRel("all-users"));
return resource;
}
```