Cloud Foundry Java Client 技术文档
1. 安装指南
Maven 依赖
要在 Maven 项目中使用 Cloud Foundry Java Client,需要在 pom.xml 文件中添加以下依赖:
<dependencies>
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-client-reactor</artifactId>
<version>latest.RELEASE</version>
</dependency>
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-operations</artifactId>
<version>latest.RELEASE</version>
</dependency>
</dependencies>
如果需要使用快照版本,还需要添加 Spring 快照仓库:
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Gradle 依赖
在 Gradle 项目中,依赖配置如下:
dependencies {
compile 'org.cloudfoundry:cloudfoundry-client-reactor:<latest>.RELEASE'
compile 'org.cloudfoundry:cloudfoundry-operations:<latest>.RELEASE'
}
同样,如果需要使用快照版本,需要添加 Spring 快照仓库:
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
2. 项目的使用说明
项目结构
Cloud Foundry Java Client 项目分为以下几个组件:
cloudfoundry-client:映射到 Cloud Foundry REST API 的接口、请求和响应对象。该项目没有实现,因此无法单独连接到 Cloud Foundry 实例。cloudfoundry-client-reactor:cloudfoundry-client项目的默认实现,基于 Reactor Netty 的HttpClient。cloudfoundry-operations:对应于 Cloud Foundry CLI 操作的 API 和实现。该项目构建在cloudfoundry-client之上,因此只有一个实现。
版本兼容性
5.x版本兼容 Spring Boot2.4.x - 2.6.x。4.x版本使用 Spring Boot2.3.x。
3. 项目API使用文档
CloudFoundryClient, DopplerClient, UaaClient 构建器
最低级别的 API 构建块是 ConnectionContext 和 TokenProvider。这些类型旨在在客户端实例之间共享,并带有开箱即用的实现。可以通过构建器来实例化它们:
DefaultConnectionContext.builder()
.apiHost(apiHost)
.build();
PasswordGrantTokenProvider.builder()
.password(password)
.username(username)
.build();
在 Spring 应用程序中,可以将它们封装在 bean 定义中:
@Bean
DefaultConnectionContext connectionContext(@Value("${cf.apiHost}") String apiHost) {
return DefaultConnectionContext.builder()
.apiHost(apiHost)
.build();
}
@Bean
PasswordGrantTokenProvider tokenProvider(@Value("${cf.username}") String username,
@Value("${cf.password}") String password) {
return PasswordGrantTokenProvider.builder()
.password(password)
.username(username)
.build();
}
CloudFoundryClient, DopplerClient, 和 UaaClient 是接口,每个接口都有一个基于 Reactor 的实现。可以通过构建器来实例化它们:
ReactorCloudFoundryClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
ReactorDopplerClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
ReactorUaaClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
在 Spring 应用程序中,可以将它们封装在 bean 定义中:
@Bean
ReactorCloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) {
return ReactorCloudFoundryClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
}
@Bean
ReactorDopplerClient dopplerClient(ConnectionContext connectionContext, TokenProvider tokenProvider) {
return ReactorDopplerClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
}
@Bean
ReactorUaaClient uaaClient(ConnectionContext connectionContext, TokenProvider tokenProvider) {
return ReactorUaaClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
}
CloudFoundryOperations 构建器
CloudFoundryOperations 层提供了更高级别的抽象,适合大多数用户使用。可以通过构建器来实例化 DefaultCloudFoundryOperations:
DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(cloudFoundryClient)
.dopplerClient(dopplerClient)
.uaaClient(uaaClient)
.organization("example-organization")
.space("example-space")
.build();
在 Spring 应用程序中,可以将它封装在 bean 定义中:
@Bean
DefaultCloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient,
DopplerClient dopplerClient,
UaaClient uaaClient,
@Value("${cf.organization}") String organization,
@Value("${cf.space}") String space) {
return DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(cloudFoundryClient)
.dopplerClient(dopplerClient)
.uaaClient(uaaClient)
.organization(organization)
.space(space)
.build();
}
CloudFoundryOperations API
一旦获得了 CloudFoundryOperations 的引用,就可以开始调用 Cloud Foundry 实例的 API。以下是一个简单的示例,列出用户所属的所有组织:
cloudFoundryOperations.organizations()
.list()
.map(OrganizationSummary::getName)
.subscribe(System.out::println);
CloudFoundryClient API
cloudfoundry-operations 实现构建在 cloudfoundry-client API 之上。以下是 Organizations.list() 方法的实现示例:
cloudFoundryClient.organizations()
.list(ListOrganizationsRequest.builder()
.page(1)
.build())
.flatMapIterable(ListOrganizationsResponse::getResources)
.map(resource -> OrganizationSummary.builder()
.id(resource.getMetadata().getId())
.name(resource.getEntity().getName())
.build());
4. 项目安装方式
项目的安装方式主要是通过 Maven 或 Gradle 添加依赖来实现。具体步骤请参考 安装指南 部分。
ERNIE-4.5-VL-28B-A3B-ThinkingERNIE-4.5-VL-28B-A3B-Thinking 是 ERNIE-4.5-VL-28B-A3B 架构的重大升级,通过中期大规模视觉-语言推理数据训练,显著提升了模型的表征能力和模态对齐,实现了多模态推理能力的突破性飞跃Python00
Kimi-K2-ThinkingKimi K2 Thinking 是最新、性能最强的开源思维模型。从 Kimi K2 开始,我们将其打造为能够逐步推理并动态调用工具的思维智能体。通过显著提升多步推理深度,并在 200–300 次连续调用中保持稳定的工具使用能力,它在 Humanity's Last Exam (HLE)、BrowseComp 等基准测试中树立了新的技术标杆。同时,K2 Thinking 是原生 INT4 量化模型,具备 256k 上下文窗口,实现了推理延迟和 GPU 内存占用的无损降低。Python00
MiniMax-M2MiniMax-M2是MiniMaxAI开源的高效MoE模型,2300亿总参数中仅激活100亿,却在编码和智能体任务上表现卓越。它支持多文件编辑、终端操作和复杂工具链调用Python00
Spark-Prover-X1-7BSpark-Prover 是由科大讯飞团队开发的专用大型语言模型,专为 Lean4 中的自动定理证明而设计。该模型采用创新的三阶段训练策略,显著增强了形式化推理能力,在同等规模的开源模型中实现了最先进的性能。Python00
MiniCPM-V-4_5MiniCPM-V 4.5 是 MiniCPM-V 系列中最新且功能最强的模型。该模型基于 Qwen3-8B 和 SigLIP2-400M 构建,总参数量为 80 亿。与之前的 MiniCPM-V 和 MiniCPM-o 模型相比,它在性能上有显著提升,并引入了新的实用功能Python00
Spark-Formalizer-X1-7BSpark-Formalizer 是由科大讯飞团队开发的专用大型语言模型,专注于数学自动形式化任务。该模型擅长将自然语言数学问题转化为精确的 Lean4 形式化语句,在形式化语句生成方面达到了业界领先水平。Python00
GOT-OCR-2.0-hf阶跃星辰StepFun推出的GOT-OCR-2.0-hf是一款强大的多语言OCR开源模型,支持从普通文档到复杂场景的文字识别。它能精准处理表格、图表、数学公式、几何图形甚至乐谱等特殊内容,输出结果可通过第三方工具渲染成多种格式。模型支持1024×1024高分辨率输入,具备多页批量处理、动态分块识别和交互式区域选择等创新功能,用户可通过坐标或颜色指定识别区域。基于Apache 2.0协议开源,提供Hugging Face演示和完整代码,适用于学术研究到工业应用的广泛场景,为OCR领域带来突破性解决方案。00