此内容没有您所选择的语言版本。

Chapter 2. Configuring your applications


This section explains how to configure your applications to work with Eclipse Vert.x runtime. It also describes the procedure to use Agroal in your Eclipse Vert.x applications.

2.1. Configuring your application to use Eclipse Vert.x

Reference the Eclipse Vert.x BOM (Bill of Materials) artifact in the pom.xml file at the root directory of your application.

Prerequisites

  • A Maven-based application

Procedure

  1. Open the pom.xml file, add the io.vertx:vertx-dependencies artifact to the <dependencyManagement> section, and specify the <type>pom</type> and <scope>import</scope>:

    <project>
      ...
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-dependencies</artifactId>
            <version>${vertx.version}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      ...
    </project>
    Copy to Clipboard Toggle word wrap
  2. Include the following properties to track the version of Eclipse Vert.x and the Vert.x Maven Plugin you are using:

    <project>
      ...
      <properties>
        <vertx.version>${vertx.version}</vertx.version>
        <vertx-maven-plugin.version>${vertx-maven-plugin.version}</vertx-maven-plugin.version>
      </properties>
      ...
    </project>
    Copy to Clipboard Toggle word wrap
  3. Reference vertx-maven-plugin as the plugin used to package your application:

    <project>
      ...
      <build>
        <plugins>
            ...
            <plugin>
                <groupId>io.reactiverse</groupId>
                <artifactId>vertx-maven-plugin</artifactId>
                <version>${vertx-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>vmp</id>
                        <goals>
                            <goal>initialize</goal>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <redeploy>true</redeploy>
                </configuration>
            </plugin>
            ...
        </plugins>
      </build>
      ...
    </project>
    Copy to Clipboard Toggle word wrap
  4. Include repositories and pluginRepositories to specify the repositories that contain the artifacts and plugins to build your application:

    <project>
    ...
      <repositories>
        <repository>
          <id>redhat-ga</id>
          <name>Red Hat GA Repository</name>
          <url>https://maven.repository.redhat.com/ga/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>redhat-ga</id>
          <name>Red Hat GA Repository</name>
          <url>https://maven.repository.redhat.com/ga/</url>
        </pluginRepository>
      </pluginRepositories>
    ...
    </project>
    Copy to Clipboard Toggle word wrap

Additional resources

  • For more information about packaging your Eclipse Vert.x application, see the Vert.x Maven Plugin documentation.

Starting with Eclipse Vert.x release 3.5.1.redhat-003, Agroal replaced C3PO as the default JDBC connection pool. C3PO and Agroal use different property names. Upgrading to a newer release of Eclipse Vert.x might break the JDBC connection pool configuration of your Eclipse Vert.x applications. Update the property names in the configuration of your JDBC connection pool to avoid this issue.

Note

To continue using C3P0 as the JDBC connection pool for your application, set the value of the provider_class property in your JDBC connection pool configuration to io.vertx.ext.jdbc.spi.impl.C3P0DataSourceProvider.

Procedure

  1. Update the following property names within your JDBC connection pool configuration to match the connection pool you use:
Expand
C3P0 property nameAgroal property name

url

jdbcUrl

driver_class

driverClassName

user

principal

password

credential

castUUID

castUUID

Additional information

  • Example JDBC connection pool configuration using C3P0:

    JsonObject config = new JsonObject()
    	.put("url", JDBC_URL)
    	// set C3P0 as the JDBC connection pool:
    	.put("provider_class", "io.vertx.ext.jdbc.spi.impl.C3P0DataSourceProvider")
    	.put("driver_class", "org.postgresql.Driver")
    	.put("user", JDBC_USER)
    	.put("password", JDBC_PASSWORD)
    	.put("castUUID", true);
    Copy to Clipboard Toggle word wrap
  • Example JDBC connection pool configuration using Agroal:

    JsonObject config = new JsonObject()
    	.put("jdbcUrl", JDBC_URL)
    	.put("driverClassName", "org.postgresql.Driver")
    	.put("principal", JDBC_USER)
    	.put("credential", JDBC_PASSWORD)
    	.put("castUUID", true);
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat