第 1 章 Spring Boot 独立入门
1.1. 关于 Spring Boot 独立部署模式
在单机部署模式中,Spring Boot 应用被打包为 Jar 文件,直接在 Java 虚拟机(JVM)中运行。也就是说,Spring Boot 应用程序可以使用 java
命令直接运行,并带有 -jar 选项的 -jar
选项,例如:
java -jar SpringBootApplication.jar
其中 Spring Boot 为可执行 Jar 提供主类。
此方法打包和运行应用与微服务理念一致,其中服务打包了最低要求。容器也是最小的,只是 JVM 本身。
在 Fuse 中构建 Spring Boot 独立应用程序需要以下元素:
Fuse Bill of Materials (BOM) mvapich-进行了从 Red Hat Maven 存储库完全策展的依赖关系集合。BOM 利用 Maven 的依赖项管理机制 来定义适当的 Maven 依赖项版本。
请注意,红帽只支持 Fuse BOM 中定义的依赖项。
- Spring Boot Maven 插件实现 Maven 中 独立 Spring Boot 应用程序的构建过程。此插件负责将 Spring Boot 应用程序打包为可执行 Jar 文件。
1.1.1. 部署到 Spring Boot 2
除了 Spring Boot 1 外,您还可以选择部署到 Spring Boot 2 中。
如需有关 OpenShift 部署模式的详细信息,请参阅 OpenShift 上的 Fuse 指南。
有关 Spring Boot 1 和 Spring Boot 2 之间的所有区别的更多信息,请参阅 Spring Boot 的迁移指南和 Spring Boot 2 发行注记。
1.1.1.1. Spring Boot 2 的新 Camel 组件
Spring Boot 2 支持 Camel 版本 2.23
,因此支持一些不适用于 Spring Boot 1 的新的 camel 组件:
Spring Boot 2 的新 Camel 组件
- as2-component
- aws-iam-component
- fhir-component
- google-calendar-stream-component
- google-mail-stream-component
- google-sheets-component
- google-sheets-stream-component
- ipfs-component
- kubernetes-hpa-component
- kubernetes-job-component
- micrometer-component
- mybatis-bean-component
- nsq-component
- rxjava2
- service-component
- spring-cloud-consul
- spring-cloud-zookeeper
- testcontainers-spring
- testcontainers
- web3j-component