Search code examples
spring-cloud-contract

Spring Cloud Contract generating stubs and a standalone server with the same stubs


This question feels a bit strange, but here it goes:

I know I can use SCC in unit tests because I can access the stubs it creates.

But the question is, from the same stubs can I configure a standalone server that could run in some DEV server, lets say for some manual testing or for some Selenium testing of the frontend app that will ultimately use those stubs?


Solution

  • Have you read the docs? You can use the Stub Runner Boot application. You can read about it here https://cloud.spring.io/spring-cloud-static/Finchley.RELEASE/single/spring-cloud.html#_stub_runner_boot_application and about its Docker version here https://cloud.spring.io/spring-cloud-static/Finchley.RELEASE/single/spring-cloud.html#stubrunner-docker

    UPDATE:

    Updating links for Hoxton.SR1 release train (Spring Cloud Contract 2.2.1.RELEASE):

    Stub Runner Boot: https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.2.1.RELEASE/reference/html/project-features.html#features-stub-runner-boot

    Stub Runner Docker: https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.2.1.RELEASE/reference/html/docker-project.html