How to specify a definite port for the stub,when starting by stub-runner-boot.jar?
pastel001 opened this issue · 7 comments
How can i specify a definite port when i use stub runner jar to start the stub?
i dont want to get the port by access some like "http://localhost:8083/stubs/xxx-xxx".
thany you.
e.g. --server.port=8766
You can read more about this here https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html . The property's called server.port
Infact I want to know how to definite the port which to access some stubs
Just read the docs :) https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_stub_runner_stubs_ids
Let's say that you have a stub with group id foo
, artifact id bar
. So you have to pass the property like this
stubrunner.ids=foo:bar:stubs:+:8765
That way the classifier will be stubs
, the version will be +
== latest
and it will get registered at port 8765
Sorry,English bad.
i have read Spring Cloud Contract Workshops,i know how to use stub in consumer code
just use like this.
@AutoConfigureStubRunner(workOffline = true, ids = "com.example:beer-api-producer:+:stubs:8090")
but i dont find how to use when using stub runner jar in (http://cloud-samples.spring.io/spring-cloud-contract-samples/tutorials/stub_runner_boot.html).
Infact i should be able to understand how to defind the port
Thank you
It's a normal Spring Boot application. Just pass it as presented here - https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html . I wrote it to you in the previous comment
java -jar -Dstubrunner.ids=foo:bar:stubs:+:8765 stub-runner.jar
or
java -jar stub-runner.jar --stubrunner.ids=foo:bar:stubs:+:8765
Yes,Thank you, I know it now.