第 3 章 Spring 和 Spring Boot
3.1. Spring 和 Spring Boot 指南 复制链接链接已复制到粘贴板!
这些代码教程使用 Data Grid 服务器,并且至少需要一个正在运行的实例。
运行 Spring 示例
mvn -s /path/to/maven-settings.xml package exec:exec
$ mvn -s /path/to/maven-settings.xml package exec:exec
运行 Spring Boot 示例
mvn -s /path/to/maven-settings.xml spring-boot:run
$ mvn -s /path/to/maven-settings.xml spring-boot:run
显示激活器统计
导航到浏览器中的 http://localhost:8080/actuator/metrics,以显示可用指标列表。缓存指标前缀为 "cache"。使用标签显示每个缓存的每个指标。例如,basque-names 缓存中的 'puts' 统计:
http://localhost:8080/actuator/metrics/cache.puts?tag=name:basque-names
使用 Prometheus 收集统计信息
此项目中的 prometheus.yml 文件包含 host.docker.internal 绑定,允许 Prometheus 清理 Spring actuator 公开的指标。
将以下命令中的 YOUR_PATH 值改为运行 Prometheus 的目录,然后运行:
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
$ 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
| 教程链接 | 描述 |
|---|---|
| 演示了如何在 Spring Boot 和 Data Grid Server 中使用 Spring Caches。 | |
| 演示了如何在 Spring Boot 和 Data Grid Server 中使用 Spring Session。 | |
| 演示了如何在 Spring Boot 和 Data Grid Embedded 中使用 Spring Caches。 | |
| 演示了如何在 Spring Boot 和 Data Grid Embeded 中使用 Spring Session。 | |
| 演示了如何在没有 Spring Boot 的情况下使用 Spring Cache 和 Data Grid Embeded。 | |
| 演示了如何在没有 Spring Boot 的情况下使用 Spring Session 和 Data Grid Embeded。 |
Data Grid 文档
您可以在以下文档中找到更多资源: