{"id":289744,"date":"2018-09-22T01:45:02","date_gmt":"2018-09-21T21:45:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289744"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289744","title":{"rendered":"\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Cloud Contract"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>  <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7c0\/5b5\/94e\/7c05b594eadb63034b1b9d80282030f9.png\" height=\"420\" width=\"420\"><\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043f\u043e HTTP. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 Spring Cloud Contract, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432\u0432\u043e\u0434\u0438\u0442 \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 cloud.<br \/>  \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 API \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u0445. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0414\u043b\u044f \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f mockMCV \u0438\u043b\u0438 RestAssured. \u0414\u043b\u044f \u043c\u043e\u043a\u043e\u0432 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u043e\u0441\u043a-\u0441\u0435\u0440\u0432\u0435\u0440\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Wiremock \u0438\u043b\u0438 Pact. \u041d\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u043f\u0438\u0448\u0443\u0442 \u043e\u0434\u043d\u0438 \u043b\u044e\u0434\u0438, \u0430 \u043c\u043e\u043a\u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<br \/>  \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0440\u043e\u043b\u0431\u0435\u043c\u0430\u043c \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c 204 NO_CONTENT, \u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c 200 OK \u0438 \u043f\u0443\u0441\u0442\u043e\u0439 json.<br \/>  \u0422\u0443\u0442 \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u043a\u0442\u043e \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0430\u0432. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043d\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u044d\u0442\u0430\u043f\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0440\u0435\u0448\u0438\u0442\u044c spring cloud contract.<\/p>\n<p>  <\/p>\n<p><strong>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 spring cloud contract <\/strong><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430 yaml \u0438\u043b\u0438 groovyDSL \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043e\u0442\u0432\u0435\u0442. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043b\u0435\u0436\u0430\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>\/src\/test\/resources\/contracts\/*<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 GET-endpoint<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@GetMapping(\"\/bets\/{userId}\") public ResponseEntity&lt;List&lt;Bet&gt;&gt; getBets(@PathVariable(\"userId\") String userId) {    List&lt;Bet&gt; bets = service.getByUserId(userId);    if (bets.isEmpty()) {        return ResponseEntity.noContent().build();    }    return ResponseEntity.ok(bets); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/p>\n<p>  <\/p>\n<pre><code>org.springframework.cloud.contract.spec.Contract.make {    request {        method 'GET'        urlPath '\/bets\/2'    }    response {        status 200        headers {            header('Content-Type', 'application\/json')        }        body('''          {            \"sport\":\"football\",            \"amount\": 1          }          '''        )    } } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e maven \u0438\u043b\u0438 gradle \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0438 json\u2019\u044b \u0434\u043b\u044f <a href=\"http:\/\/wiremock.org\/\">wiremock<\/a>.<br \/>  JSON \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code>{  \"id\" : \"df8f7b73-c242-4664-add3-7214ac6356ff\",  \"request\" : {    \"urlPath\" : \"\/bets\/2\",    \"method\" : \"GET\"  },  \"response\" : {    \"status\" : 200,    \"body\" : \"{\\\"amount\\\":1,\\\"sport\\\":\\\"football\\\"}\",    \"headers\" : {      \"Content-Type\" : \"application\/json\"    },    \"transformers\" : [ \"response-template\" ]  },  \"uuid\" : \"df8f7b73-c242-4664-add3-7214ac6356ff\" }<\/code><\/pre>\n<p>  <\/p>\n<p>Wiremock \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c jar <a href=\"http:\/\/wiremock.org\/docs\/running-standalone\/\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e json-\u043c\u043e\u043a\u0438 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0443 <code>mappings<\/code>.<\/p>\n<p>  <\/p>\n<pre><code>$java -jar wiremock-standalone-2.18.0.jar <\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0441\u0433\u0435\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 RestAssured, \u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0430\u0432\u0430\u043d\u044b mockMVC \u0438\u043b\u0438 spockframework.<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public class UserControllerTest extends ContractBae {    @Test   public void validate_get_200() throws Exception {      \/\/ given:         MockMvcRequestSpecification request = given();       \/\/ when:         ResponseOptions response = given().spec(request)               .get(\"\/bets\/2\");       \/\/ then:         assertThat(response.statusCode()).isEqualTo(200);         assertThat(response.header(\"Content-Type\")).isEqualTo(\"application\/json\");      \/\/ and:         DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());         assertThatJson(parsedJson).field(\"['amount']\").isEqualTo(1);         assertThatJson(parsedJson).field(\"['sport']\").isEqualTo(\"football\");   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 (\u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u0443\u0442\u044c \u043a \u0431\u0430\u0437\u043e\u0432\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u0430.<br \/>  \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SccDemoApplication.class) public abstract class ContractBae {    @LocalServerPort    int port;    @Autowired    protected WebApplicationContext webApplicationContext;     @Before    public void configureRestAssured() {        RestAssured.port = port;        MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)                .build();        RestAssuredMockMvc.mockMvc(mockMvc);    } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u0438 \u0442\u0435\u0441\u0442\u044b \u0438 \u043c\u043e\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430. \u0415\u0441\u043b\u0438 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043c\u043e\u043a\u0430\u0445, \u0442\u043e \u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>  <\/p>\n<p><strong>\u041d\u043e \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0435<\/strong><br \/>  \u041c\u043e\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434, \u043d\u043e \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u0421\u043f\u0440\u0438\u043d\u0433 \u0443\u043c\u0435\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u043e\u0441\u043a-\u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c jar \u0441 \u043c\u043e\u043a\u0430\u043c\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@AutoConfigureStubRunner<\/code><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 HTTP \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@GetMapping(\"\/bets\/{userId}\") public ResponseEntity&lt;List&lt;Bet&gt;&gt; getBets(@PathVariable(\"userId\") String userId) {    if(!isUsetExists(userId)) {        return ResponseEntity.notFound().build();    }    List&lt;Bet&gt; bets = service.getByUserId(userId);    if (bets.isEmpty()) {        return ResponseEntity.noContent().build();    }    return ResponseEntity.ok(bets); }  private boolean isUsetExists(String userId) {    try {        restTemplate.getForObject(\"\/exists\/\" + userId, Void.class);        return true;    } catch (HttpStatusCodeException ignore) {        return false;    } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u044c \u043a jar \u0441 \u043c\u043e\u043a\u0430\u043c\u0438 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SccDemoApplication.class) @AutoConfigureStubRunner(ids = {\"me.dehasi.contracts.demo:sub-service-stubs:+:stubs:8090\"}, stubsMode = StubRunnerProperties.StubsMode.LOCAL) public abstract class ContractBase {<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u043a. \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0442\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0436\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ascii-doc \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u044b (\u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e rest-docs <a href=\"https:\/\/habr.com\/post\/341636\/\">\u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a>) .<\/p>\n<p>  <\/p>\n<p><strong>\u0427\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c<\/strong><br \/>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a API \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b (\u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0449\u0435 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e), \u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0436\u0435 \u043c\u043e\u043a\u0438. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0440\u0438\u0441\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/spring.io\/guides\/gs\/contract-rest\/\">\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<\/a><br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u0437\u044f\u0442\u044b \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/dehasi\/scc_gp\">\u0442\u0443\u0442<\/a><\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/424057\/\"> https:\/\/habr.com\/post\/424057\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>  <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7c0\/5b5\/94e\/7c05b594eadb63034b1b9d80282030f9.png\" height=\"420\" width=\"420\"><\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043f\u043e HTTP. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 Spring Cloud Contract, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432\u0432\u043e\u0434\u0438\u0442 \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 cloud.<br \/>  \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 API \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u0445. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-289744","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289744"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289744\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}