Skip to content

Could use more info about how to support jax-rs endpoints #2290

@davidmichaelkarr

Description

@davidmichaelkarr

I'm looking at implementing spring contracts in our builds. We have numerous services providing jax-rs endpoints. We have recently provided the ability to provide SpringMVC endpoints, but that is very new and only a handful of services are using that as of now.

I've verified that the contract tests work fine in services that provide SpringMVC endpoints. I was under the impression that Spring Contracts simply doesn't support JAX-RS, but then I read more carefully at https://docs.spring.io/spring-cloud-contract/reference/getting-started/first-application.html, where it specifically refers to "which framework and test type you have set up in your plugin", and it shows simple examples of the generated tests using jax-rs or "webtestclient". However, all it says about how to produce either of these is to "add its library to your classpath". It's not clear which dependency(ies) I have to add to produce jax-rs-based tests. I asked Copilot, and it told me about some "spring-cloud-contract-verifier-jaxrs" dependency, which appears to be a hallucination. From what I can see,

When I ran "mvn help:describe -Dplugin=org.springframework.cloud:spring-cloud-contract-maven-plugin -Ddetail" and I inspected the detailed output in "generateTests", I saw:

    testMode (Default: MOCKMVC)
      (no description available)

I then searched the codebase for this, and I found a little more information. I found a "jax-rs.adoc" file that mentioned a couple of things, like setting the testMode to "JAXRSCLIENT", defining a "WebTarget" instance variable in the base class, and "start a web server". Is this information valid? I didn't see a single check in the code for this testMode value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions