第 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
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.