1.6. 使用 Maven 为 Spring Boot 应用程序生成 Camel


您可以使用 Maven archetype org.apache.camel.archetypes:camel-archetype-spring-boot:3.14.2 生成 Camel Spring Boot 应用程序。

流程

  1. 运行以下命令:

    mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes \
      -DarchetypeArtifactId=camel-archetype-spring-boot \
      -DarchetypeVersion=3.14.2 \
      -DgroupId=com.redhat \
      -DartifactId=csb-app \
      -Dversion=1.0-SNAPSHOT \
      -DinteractiveMode=false \
      -Dspring-boot-version=2.7.1
  2. 编辑 pom.xml 文件,以更改 org.apache.camel.springboot:camel-spring-boot-dependencies 中的 org.apache.camel.springboot-dependencies 版本

    <version>3.14.2</version>

    <version>3.14.2.redhat-00054</version>
  3. 构建应用程序:

    mvn package -f csb-app/pom.xml
  4. 运行应用程序:

    java -jar csb-app/target/csb-app-1.0-SNAPSHOT.jar
  5. 检查应用生成的 Hello World 输出的控制台日志,以验证应用正在运行。

    com.redhat.MySpringBootApplication       : Started MySpringBootApplication in 3.514 seconds (JVM running for 4.006)
    Hello World
    Hello World
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.