my-spring-boot-experiments
  • README
  • Spring Batch implementation
  • API Example for Archunit
  • spring-boot-chaos-monkey
  • Grafana LGTM Implementation
  • MongoDb for insertion and search using elastic search
  • OpenSearch Implementation
  • spring-boot-rabbitmq-thymeleaf
  • boot-rest-docs-sample
  • boot-strategy-plugin
  • spring-boot-togglz-sample
  • spring-boot-ultimate-redis
  • GraphQL
    • spring-boot-graphql-querydsl
    • GraphQl implementation using webflux
    • GraphQl implementation using webmvc
  • httpClients
    • http-proxy
    • rest-template
    • rest-client
    • web-client-mvc
    • web-client-webflux
  • jmh-benchmark
  • jpa
    • Custom Sequence
    • Hibernate Envers Implementation
    • multiple datasources using Spring Boot
    • spring-boot-hibernate2ndlevelcache-sample
    • JNDI in embedded Tomcat
    • JPA Jooq Marriage
    • JPA locks implementation
    • read-replica-with-spring-boot
    • KeySet Pagination Using Blaze
    • KeySet Pagination Using Data-JPA
    • MultiTenancy using Hibernate in Spring Data JPA
      • multitenancy-db
      • multidatasource-multitenancy
      • Partitioned (Discriminator) Data – the data for each tenant is partitioned by a discriminator value
      • schema
  • open-api-spring-boot
  • r2dbc
    • r2dbc-jooq
    • PostgreSQL JSON and enum column support
    • PostgreSQL Notify and Listen support using reactive spring boot
    • r2dbc-boot
    • reactive-cache
  • scheduler
    • Scheduling using JobRunr
    • Scheduling using Quartz
    • Scheduling using Shedlock distribution
  • Code Of Conduct
Powered by GitBook
On this page
  • Spring RestTemplate Overview
  • Run tests
  • Run locally
  • Useful Links

Was this helpful?

Edit on GitHub
  1. httpClients

rest-template

Spring RestTemplate Overview

RestTemplate is a class in the Spring Framework that is used to perform HTTP requests to RESTful web services. It is a high-level, easy-to-use interface that abstracts away the complexity of making requests and handling responses.

RestTemplate provides several methods for making HTTP requests, including getForObject, postForObject, put, and delete. These methods can be used to perform a variety of HTTP requests, such as GET, POST, PUT, DELETE, etc., and can accept arguments such as the URL of the web service, the request body (for POST and PUT requests), and any headers or query parameters that need to be included in the request.

RestTemplate also provides convenience methods for handling responses, such as getForEntity, which returns a ResponseEntity object that can be used to access the response body, headers, and status code.

RestTemplate is a useful tool for interacting with RESTful web services in the Spring Framework, and is often used in Spring-based applications to consume web services.

Run tests

$ ./mvnw clean verify

Run locally

$ docker-compose -f docker/docker-compose.yml up -d
$ ./mvnw spring-boot:run -Dspring-boot.run.profiles=local

Useful Links

  • Swagger UI: http://localhost:8080/swagger-ui.html

  • Actuator Endpoint: http://localhost:8080/actuator

Previoushttp-proxyNextrest-client

Last updated 1 year ago

Was this helpful?