🗊Презентация Spring data rest

Нажмите для полного просмотра!
Spring data rest, слайд №1Spring data rest, слайд №2Spring data rest, слайд №3Spring data rest, слайд №4Spring data rest, слайд №5Spring data rest, слайд №6Spring data rest, слайд №7Spring data rest, слайд №8Spring data rest, слайд №9Spring data rest, слайд №10Spring data rest, слайд №11Spring data rest, слайд №12Spring data rest, слайд №13Spring data rest, слайд №14Spring data rest, слайд №15Spring data rest, слайд №16Spring data rest, слайд №17Spring data rest, слайд №18

Вы можете ознакомиться и скачать презентацию на тему Spring data rest. Доклад-сообщение содержит 18 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





Spring data rest
Описание слайда:
Spring data rest

Слайд 2





Features	
Provides rest api for domain model using HAL.
Supports pagination.
Allows to define projections.
Описание слайда:
Features Provides rest api for domain model using HAL. Supports pagination. Allows to define projections.

Слайд 3





What is HATEOAS?
HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server.
A core principle of HATEOAS is that resources should be discoverable through the publication of links that point to the available resources.
Описание слайда:
What is HATEOAS? HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server. A core principle of HATEOAS is that resources should be discoverable through the publication of links that point to the available resources.

Слайд 4





What is HAL?
HAL = Hypertext Application Language.
HAL is a generic media type with which Web APIs can be developed and
   exposed as series of links.
MediaType = "application/hal+json"
Описание слайда:
What is HAL? HAL = Hypertext Application Language. HAL is a generic media type with which Web APIs can be developed and exposed as series of links. MediaType = "application/hal+json"

Слайд 5





What is HAL?
GET /orders/523 HTTP/1.1
   Host: example.org
   Accept: application/hal+json

   HTTP/1.1 200 OK
   Content-Type: application/hal+json
   {
  "_embedded" : {
    "transactions" : [ {  ...    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/transactions?page=0&size=20"
    }, …
  },
  "page" : {
    "size" : 20,
    "totalElements" : 26,
    "totalPages" : 2,
    "number" : 0
  }
}
Описание слайда:
What is HAL? GET /orders/523 HTTP/1.1 Host: example.org Accept: application/hal+json HTTP/1.1 200 OK Content-Type: application/hal+json { "_embedded" : { "transactions" : [ { ... } ] }, "_links" : { "first" : { "href" : "http://localhost:8080/api/transactions?page=0&size=20" }, … }, "page" : { "size" : 20, "totalElements" : 26, "totalPages" : 2, "number" : 0 } }

Слайд 6





Dependency
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
Описание слайда:
Dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency>

Слайд 7





RepositoryRestConfigurer
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {
   return new RepositoryRestConfigurerAdapter() {
       @Override
       public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
           config.setBasePath("/api");
       }
   };
}
Описание слайда:
RepositoryRestConfigurer @Bean public RepositoryRestConfigurer repositoryRestConfigurer() { return new RepositoryRestConfigurerAdapter() { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.setBasePath("/api"); } }; }

Слайд 8





RepositoryRestConfigurer properties

basePath
defaultPageSize
maxPageSize
pageParamName
limitParamName
sortParamName
defaultMediaType
e.t.c.
Описание слайда:
RepositoryRestConfigurer properties basePath defaultPageSize maxPageSize pageParamName limitParamName sortParamName defaultMediaType e.t.c.

Слайд 9





Example
@RepositoryRestResource
public interface UserRepository extends JpaRepository<User, Long> {}
Описание слайда:
Example @RepositoryRestResource public interface UserRepository extends JpaRepository<User, Long> {}

Слайд 10





Supported http methods
GET
POST
PUT
DELETE
HEAD
OPTIONS
Описание слайда:
Supported http methods GET POST PUT DELETE HEAD OPTIONS

Слайд 11





User
@Entity
public class User {
	@Id @GeneratedValue
	private long userId;
	private String username;
	private int age;
...getters/setters
}
Описание слайда:
User @Entity public class User { @Id @GeneratedValue private long userId; private String username; private int age; ...getters/setters }

Слайд 12





How to access repository?
The path is derived from the uncapitalized, pluralized, simple class name of the domain class being managed.

User -> …/users
…/users/3
Описание слайда:
How to access repository? The path is derived from the uncapitalized, pluralized, simple class name of the domain class being managed. User -> …/users …/users/3

Слайд 13





GET request
…/users         // find all users using default pagination. Returns first page
…/users?page=1         // find all users using default pagination. Returns second page
…/users?size=2            // find all users using pagination by 2. returns first page.
Описание слайда:
GET request …/users // find all users using default pagination. Returns first page …/users?page=1 // find all users using default pagination. Returns second page …/users?size=2 // find all users using pagination by 2. returns first page.

Слайд 14





POST request 
…/users
body: 
{
	“username” : “test”,
	“age” : “1”
}
Описание слайда:
POST request …/users body: { “username” : “test”, “age” : “1” }

Слайд 15





PUT request
…/users/1
body: 
{
	“username” : “test”,
	“age” : “1”
}
Описание слайда:
PUT request …/users/1 body: { “username” : “test”, “age” : “1” }

Слайд 16





DELETE request
…/users/1
Описание слайда:
DELETE request …/users/1

Слайд 17





Custom database query
@RepositoryRestResource
public interface UserRepository extends JpaRepository<User, Long> {
	Collection<User> findByAge(@Param(“age”) int age);
}
Описание слайда:
Custom database query @RepositoryRestResource public interface UserRepository extends JpaRepository<User, Long> { Collection<User> findByAge(@Param(“age”) int age); }

Слайд 18





Custom database query call
.../users/search/findByAge?age=10
Описание слайда:
Custom database query call .../users/search/findByAge?age=10



Теги Spring data rest
Похожие презентации
Mypresentation.ru
Загрузить презентацию