6.2. Service Registry Java クライアントアプリケーションの作成
Service Registry Java クライアントクラスを使用して、Service Registry に保存されたアーティファクトを管理する Java クライアントアプリケーションを作成できます。
前提条件
- Service Registry が環境にインストールされ、実行している。
- Java クライアントアプリケーション用の Maven プロジェクトを作成しました。詳細は、Apache Maven を参照。
手順
以下の依存関係を Maven プロジェクトに追加します。
<dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-client</artifactId> <version>${apicurio-registry.version}</version> </dependency>次のように Service Registry クライアントを作成します。
public class ClientExample { public static void main(String[] args) throws Exception { // Create a registry client String registryUrl = "https://my-registry.my-domain.com/apis/registry/v2";1 RegistryClient client = RegistryClientFactory.create(registryUrl);2 } }
クライアントが作成されると、クライアントの Service Registry REST API で使用可能なすべての操作を使用できます。詳細は、Apicurio Registry REST API ドキュメント を参照してください。