Project Basics Example using Spring Boot 3.0

Overview

Base Project Spring 3.0

Exaples of the acess - API localhost

Method create - POST

Content-Type = application/json

URL: localhost:8080/api/persons

Body:

{
    "name": "Marian Lemans",
    "email": "[email protected]",
    "birthDate": "1997-09-23",
    "gender": {
        "description": "Male"
    },
    "address": {
        "street": "Street Teste",
        "district": "District Teste",
        "number": 123
    }
}

Return:

{
    "id": 2,
    "name": "Marian Lemans",
    "email": "[email protected]",
    "birthDate": "1997-09-23",
    "gender": {
        "description": "Male"
    },
    "address": {
        "id": 2,
        "street": "Street Teste",
        "district": "District Teste",
        "number": 123
    }
}

Method update - PUT

Content-Type = application/json

URL: localhost:8080/api/persons

Body:

{
    "id": 2,
    "name": "Marian Lemans",
    "email": "[email protected]",
    "birthDate": "1997-09-23",
    "gender": {
        "description": "Male"
    },
    "address": {
        "id": 2,
        "street": "Street Teste",
        "district": "District Teste",
        "number": 123
    }
}

Return:

{
    "id": 2,
    "name": "Marian Lemans",
    "email": "[email protected]",
    "birthDate": "1997-09-23",
    "gender": {
        "description": "Male"
    },
    "address": {
        "id": 2,
        "street": "Street Teste",
        "district": "District Teste",
        "number": 123
    }
}

Method get all pageable - GET

URL: http://localhost:8080/api/persons/0/10

Return:

{
    "content": [
        {
            "id": 8,
            "name": "Martina",
            "email": "[email protected]",
            "birthDate": "2022-02-16",
            "gender": {
                "description": "Female"
            },
            "address": {
                "id": 8,
                "street": "Street Teste",
                "district": "District Teste yyyy",
                "number": 34
            }
        },
        {
            "id": 9,
            "name": "Denis Rodman",
            "email": "[email protected]",
            "birthDate": "2022-02-02",
            "gender": {
                "description": "Male"
            },
            "address": {
                "id": 9,
                "street": "Street Test 4",
                "district": "District Teste",
                "number": 67
            }
        },
        {
            "id": 10,
            "name": "Robbin William",
            "email": "[email protected]",
            "birthDate": "2022-02-07",
            "gender": {
                "description": "Male"
            },
            "address": {
                "id": 10,
                "street": "Street Test 4",
                "district": "District Teste yyyy",
                "number": 56
            }
        },
        {
            "id": 2,
            "name": "Marian Lemans",
            "email": "[email protected]",
            "birthDate": "1997-09-23",
            "gender": {
                "description": "Male"
            },
            "address": {
                "id": 1,
                "street": "Street Teste",
                "district": "District Teste",
                "number": 123
            }
        }
    ],
    "pageable": {
        "sort": {
            "empty": true,
            "sorted": false,
            "unsorted": true
        },
        "offset": 0,
        "pageSize": 10,
        "pageNumber": 0,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 1,
    "totalElements": 4,
    "last": true,
    "size": 10,
    "number": 0,
    "sort": {
        "empty": true,
        "sorted": false,
        "unsorted": true
    },
    "first": true,
    "numberOfElements": 4,
    "empty": false
}

Method get all pageable with word search - GET

URL: http://localhost:8080/api/persons/0/10/de

Return:

{
    "content": [
        {
            "id": 9,
            "name": "Denis Rodman",
            "email": "[email protected]",
            "birthDate": "2022-02-02",
            "gender": {
                "description": "Male"
            },
            "address": {
                "id": 9,
                "street": "Street Test 4",
                "district": "District Teste",
                "number": 67
            }
        }
    ],
    "pageable": {
        "sort": {
            "empty": true,
            "sorted": false,
            "unsorted": true
        },
        "offset": 0,
        "pageSize": 10,
        "pageNumber": 0,
        "paged": true,
        "unpaged": false
    },
    "totalPages": 1,
    "totalElements": 1,
    "last": true,
    "size": 10,
    "number": 0,
    "sort": {
        "empty": true,
        "sorted": false,
        "unsorted": true
    },
    "first": true,
    "numberOfElements": 1,
    "empty": false
}

Method get one - GET

URL: localhost:8080/api/persons/2

Return:

{
    "id": 2,
    "name": "Marian Lemans",
    "email": "[email protected]",
    "birthDate": "1997-09-23",
    "gender": {
        "description": "Female"
    },
    "address": {
        "id": 1,
        "street": "Street Teste",
        "district": "District Teste",
        "number": 123
    }
}

Method delete - DELETE

URL: localhost:8080/api/persons/1

Return: No content

You might also like...

Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

Jan 26, 2022

Spring Boot Project Example by Evren Tan

A Complete Spring Boot Example Project A Complete Spring Boot Example Project with Spring Boot 2.6.2, JDK 17 & Maven. Table of Contents How to Contrib

Nov 28, 2022

Example project of Spring Boot Microservices with the following services School and Student

SpringBootMicroservicesWithDiscoveryGatewayConfig Example project of Spring Boot Microservices with the following services School and Student, additio

Nov 28, 2022

The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker.

gke-springboot-sampleapp 👋 The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker. Usage To be

Feb 1, 2022

Spring Boot Refresh Token using JWT example - Expire and Renew JWT Token

Spring Boot Refresh Token using JWT example - Expire and Renew JWT Token

Spring Boot Refresh Token with JWT example Build JWT Refresh Token in the Java Spring Boot Application. You can know how to expire the JWT, then renew

Dec 28, 2022

Spring boot microservice example with Eureka Server + Eureka Client + Spring Cloud API Gateway + OAuth2.0 + Circuit Breaker + Resilience4J + FeignClient + RestTemplate

Spring boot microservice example with Eureka Server + Eureka Client + Spring Cloud API Gateway + OAuth2.0 + Circuit Breaker + Resilience4J + FeignClient + RestTemplate

Spring boot microservice example Spring boot microservice example with Eureka Server + Eureka Client + Spring Cloud API Gateway + OAuth2.0 + Circuit B

Dec 29, 2022

Spring JPA @Query for custom query in Spring Boot example

Spring JPA @Query example (Custom query) in Spring Boot Use Spring JPA @Query for custom query in Spring Boot example: Way to use JPQL (Java Persisten

Dec 3, 2022

Spring JPA Native Query example in Spring Boot

Spring JPA Native Query example in Spring Boot

Nov 30, 2022

Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

Dec 28, 2022
Owner
Joshua Maia Rodrigues
• Desenvolvedor Full Stack Sênior Angular <-> Spring Boot <-> Java
Joshua Maia Rodrigues
该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的线上博客项目/企业大型商城系统/前后端分离实践项目等,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。

Spring Boot Projects 该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的前

十三 4.5k Dec 30, 2022
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
Spring Boot JdbcTemplate example with SQL Server: CRUD Rest API using Spring Data JDBC, Spring Web MVC

Spring Boot JdbcTemplate example with SQL Server: Build CRUD Rest API Build a Spring Boot CRUD Rest API example that uses Spring Data Jdbc to make CRU

null 7 Dec 20, 2022
Spring Boot Security Login example with JWT and H2 example

Spring Boot Security Login example with JWT and H2 example Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookie Spring Boot R

null 50 Dec 21, 2022
This is an example of how conditional events can be triggered in Camunda using a simple spring boot project

Camunda Conditional Events Example This example is a Spring Boot Application using Camunda. In this example i'll show a variety of ways that BPMN's Co

Niall 5 Sep 30, 2021
This project contains a full example of an application developed using Spring Boot and GraphQL within the Java.

Spring boot GraphQL Example This project contains a full example of an application developed using GraphQL within the Java. The project includes a com

Haoqiao Wang 3 Jul 20, 2022
Zitadel.ch Example Project with Spring Boot and Spring Security

Zitadel Example Project with Spring Boot and Spring Security This example contains two Spring Boot Apps (app and api) which use the Zitadel IdP as Ope

Thomas Darimont 2 May 3, 2022
An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or to turn an existing project into a devops project using open source software (Git, Docker, Jenkins..)

DevOpsify Description An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or t

obaydah bouifadene 14 Nov 8, 2022
This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

GowthamRaj K 3 Nov 2, 2021
Spring Boot & MongoDB Login and Registration example with JWT, Spring Security, Spring Data MongoDB

Spring Boot Login and Registration example with MongoDB Build a Spring Boot Auth with HttpOnly Cookie, JWT, Spring Security and Spring Data MongoDB. Y

null 15 Dec 30, 2022