{"id":356049,"date":"2024-05-20T23:21:31","date_gmt":"2024-05-20T23:21:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=356049"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-20T23:21:31","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=356049","title":{"rendered":"<span>\u041e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e REST-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432,\u00a0\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043b\u0438 \u0436\u0438\u0437\u043d\u044c \u0431\u0435\u0437 Open API<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u0432 \u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u0441 \u043c\u043e\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u043c-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043a\u0440\u0443\u043f\u043d\u043e\u0439 \u0441\u043e\u0444\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0437\u0430\u0448\u0451\u043b \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. \u0412 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043c\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0432\u0430\u044e\u0442 API, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442: Open API. Open API, \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432.\u00a0<\/p>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439 \u0417\u044f\u0431\u043b\u0438\u043d, \u044f \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u00ab\u041c\u0430\u0433\u043d\u0438\u0442\u0435\u00bb. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0434\u043b\u044f Java \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430.\u00a0<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438\u00a0<\/h2>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f: \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 REST API (\u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a), \u0434\u0440\u0443\u0433\u0430\u044f \u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 (\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c). \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API, \u0438 \u0431\u044b\u043b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 Open API, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a Swagger. \u041e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f RESTful \u2014 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e API. <\/p>\n<p>OpenAPI-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u0438\u043b\u0438 YAML \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API.\u00a0<\/p>\n<p>OpenAPI \u2014 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043f\u0438\u0448\u0443\u0449\u0438\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 Java, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0442\u0430\u043a \u043b\u0438 \u0443\u0436 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u0432\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 OpenAPI? \u041d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0434\u043b\u044f Java \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430?\u00a0<\/p>\n<p>\u0414\u0430, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430 Java\u202f\u0438 Spring \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a.\u00a0\u00a0<\/p>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434: \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435: \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a API \u0438 \u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: <\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a API \u2013 producer,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c API \u2013 consumer. <\/p>\n<\/li>\n<\/ul>\n<p>Producer \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u0447\u0435\u0440\u0435\u0437 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0438\u0445 \u0431\u0435\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.\u00a0<\/p>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 API, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 \u0434\u0432\u0443\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: POJO-\u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<h2>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 producer<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b.\u00a0<\/p>\n<pre><code class=\"java\">allprojects {      group = 'com.example.producer'      version = '0.0.1'      sourceCompatibility = '11'      repositories {          mavenCentral()          mavenLocal()      }  } <\/code><\/pre>\n<pre><code class=\"java\">subprojects {      apply plugin: 'java'      apply plugin: 'org.springframework.boot'      apply plugin: 'io.spring.dependency-management'      dependencies {          implementation 'org.springframework.boot:spring-boot-starter-web'          compileOnly 'org.projectlombok:lombok'          annotationProcessor 'org.projectlombok:lombok'      }    } <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c model, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0430 maven-publish.\u00a0<\/p>\n<pre><code class=\"java\">apply plugin: 'maven-publish'    jar {      enabled=true      archiveClassifier.set(\"\")  }    bootJar {      enabled = false  }    publishing {      publications {          maven(MavenPublication) {              artifact jar          }      }      repositories {          mavenLocal()      }  } <\/code><\/pre>\n<p>\u0421\u0430\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u044c:\u00a0<\/p>\n<pre><code class=\"java\">package com.example.producer.model;    import lombok.Builder;  import lombok.Getter;  import lombok.Setter;    @Getter  @Setter  @Builder  public class Employee {        private Long id;        private  String name;  } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c:\u00a0<\/p>\n<pre><code class=\"java\">gradle clean build publish <\/code><\/pre>\n<h2>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 consumer<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 consumer \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438.\u00a0<\/p>\n<pre><code class=\"java\">ext {      set('producerVersion', \"0.0.1\")  } <\/code><\/pre>\n<pre><code class=\"java\">dependencies {      implementation \"com.example.producer:model:${producerVersion}\"  } <\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 producer \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438\u0447\u0451\u043c \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<h2>\u041d\u0443 \u0430 \u0433\u0434\u0435 \u0436\u0435 API?<\/h2>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u2014 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u044d\u0442\u043e \u0432\u0435\u0449\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0438 \u0434\u0440\u0435\u0432\u043d\u044f\u044f. \u0410 \u0433\u0434\u0435 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0433\u0434\u0435 \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0439 REST, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u0440\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.\u00a0<\/p>\n<h4>Spring Cloud OpenFeign<\/h4>\n<p>Spring Cloud OpenFeign (\u0434\u0430\u043b\u0435\u0435 Feign) \u2014 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 REST \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Spring Boot. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043a\u043e\u0434\u0430, \u043a\u0440\u043e\u043c\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u042d\u0442\u043e\u0439 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u044b \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f API \u0441 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u043c\u0438. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Feign \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 Spring MVC.\u00a0<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h4>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e Spring \u2013 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445.\u00a0<\/p>\n<h4>\u041c\u043e\u0434\u0443\u043b\u044c Common API<\/h4>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u043e \u0438 \u0442\u0438\u043f\u044b \u0432\u0435\u0431-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 REST-API. \u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e\u0437\u0434\u043d\u0435\u0435.\u00a0<\/p>\n<pre><code class=\"java\">dependencies {      implementation project(\":model\")  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.producer.common.api;    import com.example.producer.model.Employee;  import java.util.List;  import org.springframework.web.bind.annotation.GetMapping;  import org.springframework.web.bind.annotation.PathVariable;    public interface EmployeeApi {       String path = \"\/employee\";        @GetMapping(\"findById\/{id}\")      Employee findById(@PathVariable Long id);        @GetMapping(\"findByName\/{name}\")      Employee findByName(@PathVariable String name);        @GetMapping(\"findAll\")      List&lt;Employee> findAll();  } <\/code><\/pre>\n<h4>\u041c\u043e\u0434\u0443\u043b\u044c API<\/h4>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 EmployeeAPI.\u00a0<\/p>\n<pre><code class=\"java\">dependencies {      implementation project(\":model\")      implementation project(\":common-api\")  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.producer.controller;    import com.example.producer.common.api.EmployeeApi;  import com.example.producer.model.Employee;  import java.util.List;  import org.springframework.web.bind.annotation.RequestMapping;  import org.springframework.web.bind.annotation.RestController;    @RestController  @RequestMapping(EmployeeApi.path)  public class EmployeeController implements EmployeeApi {        @Override      public Employee findById(Long id) {          return Employee.builder().id(id).name(\"test1\").build();      }        @Override      public Employee findByName(String name) {          return Employee.builder().id(1L).name(name).build();      }        @Override      public List&lt;Employee> findAll() {          return List.of(Employee.builder().id(1L).name(\"test3\").build());      }    } <\/code><\/pre>\n<h2>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0438. \u041e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Common API \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:\u00a0<\/p>\n<pre><code class=\"java\">apply plugin: 'maven-publish'    jar {      enabled=true      archiveClassifier.set(\"\")  }    bootJar {      enabled = false  }    publishing {      publications {          maven(MavenPublication) {              artifact jar          }      }      repositories {          mavenLocal()      }  }  <\/code><\/pre>\n<p>\u0418 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432 \u0432\u0435\u0440\u0441\u0438\u044e.\u00a0\u00a0<\/p>\n<pre><code class=\"java\">allprojects {      group = 'com.example.producer'      version = '0.0.2' <\/code><\/pre>\n<pre><code class=\"java\">gradle clean build publish <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u0442.<\/p>\n<pre><code class=\"java\">server:    port: 8096 <\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f producer \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:\u00a0<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d33\/87b\/4d4\/d3387b4d49dff2e4a9f193cdb2ad660e.png\" width=\"461\" height=\"682\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d33\/87b\/4d4\/d3387b4d49dff2e4a9f193cdb2ad660e.png\"\/><\/figure>\n<h2>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 consumer<\/h2>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 consumer Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u00a0<\/p>\n<pre><code class=\"java\">plugins {      id 'org.springframework.boot' version '2.6.2'      id 'io.spring.dependency-management' version '1.0.11.RELEASE'      id 'java'  }    group = 'com.example'  version = '0.0.1-SNAPSHOT'  sourceCompatibility = '11'    configurations {      compileOnly {          extendsFrom annotationProcessor      }  }    repositories {      mavenLocal()      mavenCentral()  }    ext {      set('springCloudVersion', \"2021.0.0\")      set('producerVersion', \"0.0.2\")  }    dependencies {      implementation 'org.springframework.boot:spring-boot-starter-web'      implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'      implementation 'io.github.openfeign:feign-jackson:9.3.1'      implementation \"com.example.producer:model:${producerVersion}\"      implementation \"com.example.producer:common-api:${producerVersion}\"      compileOnly 'org.projectlombok:lombok'      annotationProcessor 'org.projectlombok:lombok'      testImplementation 'org.springframework.boot:spring-boot-starter-test'  }    dependencyManagement {      imports {          mavenBom \"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}\"      }  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.consumer;    import org.springframework.boot.SpringApplication;  import org.springframework.boot.autoconfigure.SpringBootApplication;    @SpringBootApplication  public class ConsumerApplication {        public static void main(String[] args) {          SpringApplication.run(ConsumerApplication.class, args);      }    } <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Feign.\u00a0<\/p>\n<pre><code class=\"java\">@Configuration  @RequiredArgsConstructor  public class EmployeeConfig {         @Value(\"${producer.api.url}\")      private String baseUrl;        private final ObjectMapper mapper;        @Bean      public EmployeeApi employeeApi() {          return Feign.builder()              .contract(new SpringMvcContract())              .encoder(new JacksonEncoder(mapper))              .decoder(new JacksonDecoder(mapper))              .target(EmployeeApi.class, baseUrl.concat(EmployeeApi .path));      }      } <\/code><\/pre>\n<p>C\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f producer API.\u00a0<\/p>\n<pre><code class=\"java\">@RestController  @RequestMapping(\"employee\")  @RequiredArgsConstructor  public class EmployeeController {        private final EmployeeApi employeeApi;        @GetMapping(\"findById\/{id}\")      public Employee findById(@PathVariable Long id) {          return employeeApi.findById(id);      }        @GetMapping(\"findAll\")      public List&lt;Employee> findAll() {          return employeeApi.findAll();      }    } <\/code><\/pre>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u0438\u0434\u043d\u0430 \u0432\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u041c\u044b \u043e\u0431\u0449\u0430\u0435\u043c\u0441\u044f \u0441 REST-\u0441\u0435\u0440\u0432\u0438\u0441, \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u041e\u041e\u041f.\u00a0<\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c producer API URL.\u00a0\u00a0<\/p>\n<pre><code class=\"java\">producer:    api:      url: http:\/\/localhost:8096 <\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u0442.\u00a0<\/p>\n<pre><code class=\"java\">server:    port: 8097 <\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/h2>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c.\u00a0\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 findAll \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f consumer.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c7f\/b61\/4f1\/c7fb614f1f2dae07a1f65f9bebb7fefb.png\" width=\"461\" height=\"126\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c7f\/b61\/4f1\/c7fb614f1f2dae07a1f65f9bebb7fefb.png\"\/><\/figure>\n<h2>\u0410 \u0447\u0442\u043e \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439?<\/h2>\n<p>\u0421 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0434\u043e\u0431\u0440\u043e\u0433\u043e javadoc.\u00a0\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 producer \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438\u00a0\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 publish.gradle.<\/p>\n<pre><code class=\"java\">apply plugin: 'maven-publish'    jar {      enabled=true      archiveClassifier.set(\"\")  }    bootJar {      enabled = false  }    task packageJavadoc(type: Jar) {      from javadoc      classifier = 'javadoc'  }    publishing {      publications {          maven(MavenPublication) {              artifact jar              artifact tasks.packageJavadoc          }      }      repositories {          mavenLocal()      }  } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430.\u00a0<\/p>\n<pre><code class=\"java\">task packageJavadoc(type: Jar) {      from javadoc      classifier = 'javadoc'  } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c publish.gradle \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445:\u00a0<\/p>\n<pre><code class=\"java\">apply from: '..\/publish.gradle' <\/code><\/pre>\n<p>\u0417\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<pre><code>**   * It's a great interface   *\/  public interface EmployeeApi { <\/code><\/pre>\n<p>\u041f\u043e\u0434\u043d\u0438\u043c\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0438.\u00a0\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 consumer.\u00a0\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043b\u0430\u0433\u0438\u043d idea.\u00a0<\/p>\n<pre><code class=\"java\">plugins {      id 'org.springframework.boot' version '2.6.2'      id 'io.spring.dependency-management' version '1.0.11.RELEASE'      id 'java'      id 'idea'  } <\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0435\u0433\u043e.\u00a0<\/p>\n<pre><code class=\"java\">idea {      module {          downloadJavadoc = true      }  } <\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0435\u0438\u043c\u043f\u043e\u0440\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b2f\/2d8\/b0d\/b2f2d8b0de2b19a7db489d117e3581a0.png\" width=\"510\" height=\"272\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b2f\/2d8\/b0d\/b2f2d8b0de2b19a7db489d117e3581a0.png\"\/><\/figure>\n<hr\/>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, OpenAPI \u2014 \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:\u00a0\u00a0<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438: \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432.\u00a0\u00a0<\/p>\n<\/li>\n<li>\n<p>API \u0440\u0430\u0441\u043f\u0440\u043e\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0438 maven, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c maven.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Open API.\u00a0\u00a0<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/763952\/\"> https:\/\/habr.com\/ru\/articles\/763952\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u0432 \u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u0441 \u043c\u043e\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u043c-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043a\u0440\u0443\u043f\u043d\u043e\u0439 \u0441\u043e\u0444\u0442\u0432\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0437\u0430\u0448\u0451\u043b \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. \u0412 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u044b\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043c\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0432\u0430\u044e\u0442 API, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442: Open API. Open API, \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432.\u00a0<\/p>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439 \u0417\u044f\u0431\u043b\u0438\u043d, \u044f \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u00ab\u041c\u0430\u0433\u043d\u0438\u0442\u0435\u00bb. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0434\u043b\u044f Java \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430.\u00a0<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438\u00a0<\/h2>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f: \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 REST API (\u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a), \u0434\u0440\u0443\u0433\u0430\u044f \u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 (\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c). \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API, \u0438 \u0431\u044b\u043b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 Open API, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a Swagger. \u041e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f RESTful \u2014 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e API. <\/p>\n<p>OpenAPI-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u0438\u043b\u0438 YAML \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API.\u00a0<\/p>\n<p>OpenAPI \u2014 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438, \u043f\u0438\u0448\u0443\u0449\u0438\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 Java, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0442\u0430\u043a \u043b\u0438 \u0443\u0436 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u0432\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 OpenAPI? \u041d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0434\u043b\u044f Java \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430?\u00a0<\/p>\n<p>\u0414\u0430, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430 Java\u202f\u0438 Spring \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a.\u00a0\u00a0<\/p>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434: \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435: \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a API \u0438 \u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: <\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a API \u2013 producer,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c API \u2013 consumer. <\/p>\n<\/li>\n<\/ul>\n<p>Producer \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c API \u0447\u0435\u0440\u0435\u0437 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0438\u0445 \u0431\u0435\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.\u00a0<\/p>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 API, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 \u0434\u0432\u0443\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: POJO-\u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<h2>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 producer<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b.\u00a0<\/p>\n<pre><code class=\"java\">allprojects {      group = 'com.example.producer'      version = '0.0.1'      sourceCompatibility = '11'      repositories {          mavenCentral()          mavenLocal()      }  } <\/code><\/pre>\n<pre><code class=\"java\">subprojects {      apply plugin: 'java'      apply plugin: 'org.springframework.boot'      apply plugin: 'io.spring.dependency-management'      dependencies {          implementation 'org.springframework.boot:spring-boot-starter-web'          compileOnly 'org.projectlombok:lombok'          annotationProcessor 'org.projectlombok:lombok'      }    } <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c model, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0430 maven-publish.\u00a0<\/p>\n<pre><code class=\"java\">apply plugin: 'maven-publish'    jar {      enabled=true      archiveClassifier.set(\"\")  }    bootJar {      enabled = false  }    publishing {      publications {          maven(MavenPublication) {              artifact jar          }      }      repositories {          mavenLocal()      }  } <\/code><\/pre>\n<p>\u0421\u0430\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u044c:\u00a0<\/p>\n<pre><code class=\"java\">package com.example.producer.model;    import lombok.Builder;  import lombok.Getter;  import lombok.Setter;    @Getter  @Setter  @Builder  public class Employee {        private Long id;        private  String name;  } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c:\u00a0<\/p>\n<pre><code class=\"java\">gradle clean build publish <\/code><\/pre>\n<h2>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 consumer<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 consumer \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438.\u00a0<\/p>\n<pre><code class=\"java\">ext {      set('producerVersion', \"0.0.1\")  } <\/code><\/pre>\n<pre><code class=\"java\">dependencies {      implementation \"com.example.producer:model:${producerVersion}\"  } <\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 producer \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438\u0447\u0451\u043c \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<h2>\u041d\u0443 \u0430 \u0433\u0434\u0435 \u0436\u0435 API?<\/h2>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u2014 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u044d\u0442\u043e \u0432\u0435\u0449\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0438 \u0434\u0440\u0435\u0432\u043d\u044f\u044f. \u0410 \u0433\u0434\u0435 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0433\u0434\u0435 \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0439 REST, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u0440\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.\u00a0<\/p>\n<h4>Spring Cloud OpenFeign<\/h4>\n<p>Spring Cloud OpenFeign (\u0434\u0430\u043b\u0435\u0435 Feign) \u2014 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 REST \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Spring Boot. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043a\u043e\u0434\u0430, \u043a\u0440\u043e\u043c\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u042d\u0442\u043e\u0439 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u044b \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f API \u0441 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u043c\u0438. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Feign \u2014 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 Spring MVC.\u00a0<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h4>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e Spring \u2013 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445.\u00a0<\/p>\n<h4>\u041c\u043e\u0434\u0443\u043b\u044c Common API<\/h4>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u043e \u0438 \u0442\u0438\u043f\u044b \u0432\u0435\u0431-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 REST-API. \u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e\u0437\u0434\u043d\u0435\u0435.\u00a0<\/p>\n<pre><code class=\"java\">dependencies {      implementation project(\":model\")  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.producer.common.api;    import com.example.producer.model.Employee;  import java.util.List;  import org.springframework.web.bind.annotation.GetMapping;  import org.springframework.web.bind.annotation.PathVariable;    public interface EmployeeApi {       String path = \"\/employee\";        @GetMapping(\"findById\/{id}\")      Employee findById(@PathVariable Long id);        @GetMapping(\"findByName\/{name}\")      Employee findByName(@PathVariable String name);        @GetMapping(\"findAll\")      List&lt;Employee> findAll();  } <\/code><\/pre>\n<h4>\u041c\u043e\u0434\u0443\u043b\u044c API<\/h4>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 EmployeeAPI.\u00a0<\/p>\n<pre><code class=\"java\">dependencies {      implementation project(\":model\")      implementation project(\":common-api\")  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.producer.controller;    import com.example.producer.common.api.EmployeeApi;  import com.example.producer.model.Employee;  import java.util.List;  import org.springframework.web.bind.annotation.RequestMapping;  import org.springframework.web.bind.annotation.RestController;    @RestController  @RequestMapping(EmployeeApi.path)  public class EmployeeController implements EmployeeApi {        @Override      public Employee findById(Long id) {          return Employee.builder().id(id).name(\"test1\").build();      }        @Override      public Employee findByName(String name) {          return Employee.builder().id(1L).name(name).build();      }        @Override      public List&lt;Employee> findAll() {          return List.of(Employee.builder().id(1L).name(\"test3\").build());      }    } <\/code><\/pre>\n<h2>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 maven-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0438. \u041e\u0442\u0441\u044e\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Common API \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:\u00a0<\/p>\n<pre><code class=\"java\">apply plugin: 'maven-publish'    jar {      enabled=true      archiveClassifier.set(\"\")  }    bootJar {      enabled = false  }    publishing {      publications {          maven(MavenPublication) {              artifact jar          }      }      repositories {          mavenLocal()      }  }  <\/code><\/pre>\n<p>\u0418 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432 \u0432\u0435\u0440\u0441\u0438\u044e.\u00a0\u00a0<\/p>\n<pre><code class=\"java\">allprojects {      group = 'com.example.producer'      version = '0.0.2' <\/code><\/pre>\n<pre><code class=\"java\">gradle clean build publish <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0440\u0442.<\/p>\n<pre><code class=\"java\">server:    port: 8096 <\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f producer \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:\u00a0<\/p>\n<figure class=\"\"><\/figure>\n<h2>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 consumer<\/h2>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 consumer Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u00a0<\/p>\n<pre><code class=\"java\">plugins {      id 'org.springframework.boot' version '2.6.2'      id 'io.spring.dependency-management' version '1.0.11.RELEASE'      id 'java'  }    group = 'com.example'  version = '0.0.1-SNAPSHOT'  sourceCompatibility = '11'    configurations {      compileOnly {          extendsFrom annotationProcessor      }  }    repositories {      mavenLocal()      mavenCentral()  }    ext {      set('springCloudVersion', \"2021.0.0\")      set('producerVersion', \"0.0.2\")  }    dependencies {      implementation 'org.springframework.boot:spring-boot-starter-web'      implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'      implementation 'io.github.openfeign:feign-jackson:9.3.1'      implementation \"com.example.producer:model:${producerVersion}\"      implementation \"com.example.producer:common-api:${producerVersion}\"      compileOnly 'org.projectlombok:lombok'      annotationProcessor 'org.projectlombok:lombok'      testImplementation 'org.springframework.boot:spring-boot-starter-test'  }    dependencyManagement {      imports {          mavenBom \"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}\"      }  } <\/code><\/pre>\n<pre><code class=\"java\">package com.example.consumer;    import org.springframework.boot.SpringApplication;  import org.springframework.boot.autoconfigure.SpringBootApplication;    @SpringBootApplication  public class ConsumerApplication {        public static void main(String[] args) {          SpringApplication.run(ConsumerApplication.class, args);      }    } <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Feign.\u00a0<\/p>\n<pre><code class=\"java\">@Configuration  @RequiredArgsConstructor  public class EmployeeConfig {         @Value(\"${producer.api.url}\")      private String baseUrl;        private final ObjectMapper mapper;        @Bean      public EmployeeApi employeeApi() {          return Feign.builder()              .contract(new SpringMvcContract())              .encoder(new JacksonEncoder(mapper))              .decoder(new JacksonDecoder(mapper))              .target(EmployeeApi.class, baseUrl.concat(EmployeeApi .path));      }      } <\/code><\/pre>\n<p>C\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f producer API.\u00a0<\/p>\n<pre><code class=\"java\">@RestController  @RequestMapping(\"employee\")  @RequiredArgsConstructor  public class EmployeeController {        private final EmployeeApi employeeApi;        @GetMapping(\"findById\/{id}\")      public Employee findById(@PathVariable Long id) {          return employeeApi.findById(id);      }        @GetMapping(\"findAll\")      public List&lt;Employee> findAll() {<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-356049","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356049","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=356049"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356049\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}