Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 3. Spring and Spring Boot

download PDF

3.1. Spring and Spring Boot tutorials

Note

These code tutorials use Data Grid Server and require at least one running instance.

Run Spring examples

Two simple tutorials can be run with Spring without Spring Boot:

  • Test caching
$ {package_exec}@spring-caching
  • Test annotations
$ {package_exec}@spring-annotations

Run Spring Boot examples

$ mvn -s /path/to/maven-settings.xml spring-boot:run

Displaying actuator statistics

Navigate to http://localhost:8080/actuator/metrics in your browser to display a list of available metrics. Cache metrics are prefixed with "cache." Display each metric for each cache using tags. For example for the 'puts' stats in the basque-names cache:

http://localhost:8080/actuator/metrics/cache.puts?tag=name:basque-names

Collecting statistics with Prometheus

The prometheus.yml file in this project contains a host.docker.internal binding that allows Prometheus to scrap metrics that the Spring actuator exposes.

Change the YOUR_PATH value in the following command to the directory where Prometheus is running and then run:

Podman

$ podman run -d --name=prometheus -p 9090:9090 -v YOUR_PATH/integrations/spring-boot/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --config.file=/etc/prometheus/prometheus.yml

Tutorial linkDescription

Spring Boot and Spring Cache remote mode

Demonstrates how to use Spring Caches with Spring Boot and the Data Grid Server.

Spring Boot and Spring Session remote mode

Demonstrates how to use Spring Session with Spring Boot and the Data Grid Server.

Spring Boot and Spring Cache embedded mode

Demonstrates how to use Spring Caches with Spring Boot and Data Grid Embedded.

Spring Boot and Spring Session embedded mode

Demonstrates how to use Spring Session with Spring Boot and Data Grid Embedded.

Spring cache embedded without Spring Boot

Demonstrates how to use Spring Cache and Data Grid Embedded without Spring Boot.

Data Grid documentation

You can find more resources in our documentation at:

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.