Spring
AI
Spring AI
Java
Quarkus Spring Spring Data Spring Cloud Hibernate
Python
Database
Postgresql Mysql
Spring Cloud Contract 中文文档
    • Spring Cloud Contract Reference Documentation
    • Legal
    • Getting Started
      • Introducing Spring Cloud Contract
      • A Three-second Tour
      • Developing Your First Spring Cloud Contract-based Application
      • Step-by-step Guide to Consumer Driven Contracts (CDC) with Contracts on the Producer Side
      • Next Steps
    • Using Spring Cloud Contract
      • Provider Contract Testing with Stubs in Nexus or Artifactory
      • Provider Contract Testing with Stubs in Git
      • Consumer Driven Contracts with Contracts on the Producer Side
      • Consumer Driven Contracts with Contracts in an External Repository
      • Consumer-driven Contracts with Contracts on the Producer Side, Pushed to Git
      • Provider Contract Testing with Stubs in Artifactory for a non-Spring Application
      • Provider Contract Testing with Stubs in Artifactory in a Non-JVM World
      • Provider Contract Testing with REST Docs and Stubs in Nexus or Artifactory
    • Spring Cloud Contract Features
      • Contract DSL
        • Common Top-Level Elements
        • Dynamic properties
      • Spring Cloud Contract Integrations
        • JAX-RS
        • WebFlux with WebTestClient
        • WebFlux with Explicit Mode
        • Custom Mode
        • Working with Context Paths
        • Working with REST Docs
        • GraphQL
        • GRPC
      • Messaging
      • Spring Cloud Contract Stub Runner
        • Snapshot Versions
        • Publishing Stubs as JARs
        • Stub Runner Core
        • Stub Runner JUnit Rule and Stub Runner JUnit5 Extension
        • Stub Runner Spring Cloud
        • Using the Stub Runner Boot Application
        • Consumer-Driven Contracts: Stubs Per Consumer
        • Fetching Stubs or Contract Definitions From A Location
        • Generating Stubs at Runtime
        • Fail On No Stubs
        • Common Properties
      • Spring Cloud Contract WireMock
    • Build Tools
      • Docker Project
      • Gradle Project
      • Maven Project
    • “How-to” Guides
      • Why use Spring Cloud Contract?
      • How Can I Write Contracts in a Language Other than Groovy?
      • How Can I Provide Dynamic Values to a Contract?
      • How to Do Stubs versioning?
      • How Can I use a Common Repository with Contracts Instead of Storing Them with the Producer?
      • How Can I Use Git as the Storage for Contracts and Stubs?
      • How Can I Debug the Request/Response Being Sent by the Generated Tests Client?
      • How Can I Debug the Mapping, Request, or Response Being Sent by WireMock?
      • How Can I See What Got Registered in the HTTP Server Stub?
      • How Can I Reference Text from File?
      • How Can I Generate YAML, or X files from Spring Cloud Contract Contracts?
      • How Can I Work with Transitive Dependencies?
      • How Can I Generate Spring REST Docs Snippets from the Contracts?
      • How Can I Use Stubs from a Location
      • How Can I Generate Stubs at Runtime
      • How Can I Make The Build Pass if There Are No Contracts or Stubs
      • How Can I Mark that a Contract Is in Progress
    • Spring Cloud Contract customization
      • DSL Customization
      • WireMock Customization
      • Using the Pluggable Architecture
    • Common application properties
      • How to Build Spring Cloud Contract
      • Configuration Properties
      • YML Schema
  • Spring Cloud Contract 中文文档
  • “How-to” Guides
  • How Can I Reference Text from File?

How Can I Reference Text from File?

在 1.2.0 版中,我们添加了这个功能。你可以在 DSL 中调用 file(…​) 方法,并提供相对于合约所在位置的路径。如果你使用 YAML,可以使用 bodyFromFile 属性。

粤ICP备2024239452号-1