{"id":297506,"date":"2020-01-22T15:00:26","date_gmt":"2020-01-22T15:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297506"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297506","title":{"rendered":"\u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441\u043e Spring Boot. \u0427\u0430\u0441\u0442\u044c 2. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 Forex"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/484864\/\">\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Boot \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Spring MVC, JPA, Hibernate \u0438 H2.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0432\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u0441\u044c \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Boot \u0438 Spring Cloud.<\/p>\n<p>  \u042d\u0442\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u044b \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441\u043e Spring Boot.<\/p>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u0440\u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0438\u0445 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u043c\u0435\u043d Eureka (Eureka Naming Server) \u0438 Ribbon \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u00ab\u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441\u043e Spring Boot\u00bb:<\/p>\n<ul>\n<li>\u0427\u0430\u0441\u0442\u044c 1. <a href=\"https:\/\/habr.com\/post\/484130\/\">\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/a> <\/li>\n<li>\u0427\u0430\u0441\u0442\u044c 2. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 Forex<\/li>\n<li>\u0427\u0430\u0441\u0442\u044c 3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442 <\/li>\n<li>\u0427\u0430\u0441\u0442\u044c 4. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Ribbon \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <\/li>\n<li>\u0427\u0430\u0441\u0442\u044c 5. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u043c\u0435\u043d Eureka <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0412\u044b \u0438\u0437\u0443\u0447\u0438\u0442\u0435<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Boot?<\/li>\n<li>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c JPA \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0435\u0441\u0443\u0440\u0441?<\/li>\n<li>\u041a\u0430\u043a \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c Spring MVC, Spring Boot, JPA, Hibernate \u0438 H2 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435?<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041e\u0431\u0437\u043e\u0440 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h3>\n<p>  Forex Service (FS) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c \u0443\u0441\u043b\u0443\u0433. \u041e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0443\u0440\u0441\u043e\u0432 \u043e\u0431\u043c\u0435\u043d\u0430 \u0432\u0430\u043b\u044e\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 Forex Exchange \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0443\u0440\u0441\u043e\u0432 \u043e\u0431\u043c\u0435\u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u043b\u044e\u0442.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"java\">GET to http:\/\/localhost:8000\/currency-exchange\/from\/EUR\/to\/INR<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"json\">{   id: 10002,   from: &quot;EUR&quot;,   to: &quot;INR&quot;,   conversionMultiple: 75,   port: 8000, }<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0448\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u043c\u0435\u043d\u043d\u044b\u0439 \u043a\u0443\u0440\u0441 \u0435\u0432\u0440\u043e \u043a INR. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 ConversionMultiple \u0440\u0430\u0432\u0435\u043d 75.<\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <\/h3>\n<p>  \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bf\/mx\/i-\/bfmxi-yn9ybn72gkv5njow3duka.png\"><\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ul>\n<li><b>SpringBootMicroserviceForexServiceApplication.java<\/b> \u2014 \u043a\u043b\u0430\u0441\u0441 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Initializer. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u0442\u043e\u0447\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li><b>pom.xml<\/b> \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>Spring Boot Starter Web<\/i> \u0438 <i>JPA<\/i>.<\/li>\n<li><b>ExchangeValue.java<\/b> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u043b\u044e\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430.<\/li>\n<li><b>ExchangeValueRepository.java<\/b> \u2014 JPA \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f ExchangeValue. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Data JpaRepository.<\/li>\n<li><b>ForexController.java<\/b> \u2014 Spring REST \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u0435\u043a\u0441.<\/li>\n<li><b>data.sql<\/b> \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b exchange_value. Spring Boot \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0438\u0437 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0412\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f<\/h3>\n<p>  <\/p>\n<ul>\n<li>Maven 3.0+ \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438<\/li>\n<li>\u0412\u0430\u0448 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 IDE. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Eclipse.<\/li>\n<li>JDK 1.8+<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Maven \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430<\/h3>\n<p>  <\/p>\n<blockquote><p>\u0412 <a href=\"https:\/\/github.com\/in28minutes\/spring-boot-examples\/tree\/master\/spring-boot-basic-microservice\" rel=\"nofollow\">Github \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430<\/a>.<\/p><\/blockquote>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Initializr<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 Spring Initializr \u2014 \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u0430\u044f \u043f\u0440\u043e\u0433\u0443\u043b\u043a\u0430.<\/p>\n<p>  Spring Initializr: <b><a href=\"http:\/\/start.spring.io\/\" rel=\"nofollow\">start.spring.io<\/a><\/b> \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 Spring Boot.<\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Initializr \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tp\/jb\/xm\/tpjbxmj7hptc0urwe4dqdzvixqs.png\"><\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<p>  1. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Spring Initializr \u0438 \u043d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\u041d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 <b>com.in28minutes.springboot.microservice.example.forex<\/b> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b.<\/li>\n<li>\u041d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u0430 <b>spring-boot-microservice-forex-service<\/b>.<\/li>\n<li>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/li>\n<\/ul>\n<p>   &nbsp; &nbsp; &nbsp; &nbsp; \u2014 Web<br \/>   &nbsp; &nbsp; &nbsp; &nbsp; \u2014 DevTools<br \/>   &nbsp; &nbsp; &nbsp; &nbsp; \u2014 \u0421\u0442\u0430\u0440\u0442\u0435\u0440 JPA<br \/>   &nbsp; &nbsp; &nbsp; &nbsp; \u2014 H2<br \/>  2. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 <b>Generate Project<\/b>.<\/p>\n<p>  3. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Eclipse: File -&gt; Import -&gt; Existing Maven Project.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 Exchange Value<\/h3>\n<p>  <\/p>\n<pre><code class=\"java\">@Entity public class ExchangeValue {      @Id   private Long id;      @Column(name=&quot;currency_from&quot;)   private String from;      @Column(name=&quot;currency_to&quot;)   private String to;      private BigDecimal conversionMultiple;   private int port;      public ExchangeValue() {        }       public ExchangeValue(Long id, String from, String to, BigDecimal conversionMultiple) {     super();     this.id = id;     this.from = from;     this.to = to;     this.conversionMultiple = conversionMultiple;   }    public Long getId() {     return id;   }    public String getFrom() {     return from;   }    public String getTo() {     return to;   }    public BigDecimal getConversionMultiple() {     return conversionMultiple;   }      public int getPort() {     return port;   }    public void setPort(int port) {     this.port = port;   }  } <\/code><\/pre>\n<p>  \u0412\u0430\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li><b><a href=\"https:\/\/habr.com\/ru\/users\/entity\/\" class=\"user_link\">Entity<\/a><\/b>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e. \u042d\u0442\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/li>\n<li><b><a href=\"https:\/\/habr.com\/ru\/users\/id\/\" class=\"user_link\">Id<\/a><\/b>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 JPA-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f Exchange Value<\/h3>\n<p>  <b>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/ExchangeValueRepository.java<\/b><\/p>\n<pre><code class=\"java\">package com.in28minutes.springboot.microservice.example.forex; import org.springframework.data.jpa.repository.JpaRepository;  public interface ExchangeValueRepository extends      JpaRepository&lt;ExchangeValue, Long&gt;{   ExchangeValue findByFromAndTo(String from, String to); }<\/code><\/pre>\n<p>  <u>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f:<\/u><\/p>\n<p>  1. <b>public interface ExchangeValueRepository extends JpaRepository&lt;ExchangeValue, Long&gt;<\/b> <\/p>\n<p>  \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 JpaRepository, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0432\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430: ExchangeValue \u0438 Long. ExchangeValue \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442, \u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c ExchangeValue \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Long.<\/p>\n<p>  2. <b>ExchangeValue findByFromAndTo (String from, String to)<\/b> <\/p>\n<p>  \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b \u0432 \u0434\u0440\u0443\u0433\u0443\u044e. <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441 ForexController<\/h3>\n<p>  <b>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/ForexController.java<\/b><\/p>\n<pre><code class=\"java\">@RestController public class ForexController {      @Autowired   private Environment environment;      @Autowired   private ExchangeValueRepository repository;      @GetMapping(&quot;\/currency-exchange\/from\/{from}\/to\/{to}&quot;)   public ExchangeValue retrieveExchangeValue     (@PathVariable String from, @PathVariable String to){          ExchangeValue exchangeValue =          repository.findByFromAndTo(from, to);          exchangeValue.setPort(         Integer.parseInt(environment.getProperty(&quot;local.server.port&quot;)));          return exchangeValue;   } }<\/code><\/pre>\n<p>  <u>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f:<\/u><\/p>\n<p>  1. <b>@RestController public class ForexController {<\/b><\/p>\n<p>  &nbsp;&nbsp;&nbsp; \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/p>\n<p>  2. <b><a href=\"https:\/\/habr.com\/ru\/users\/autowired\/\" class=\"user_link\">Autowired<\/a> private Environment environment<\/b> <\/p>\n<p>  &nbsp;&nbsp;&nbsp; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0440\u0442 (port) \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<p>  3. <b><a href=\"https:\/\/habr.com\/ru\/users\/autowired\/\" class=\"user_link\">Autowired<\/a> private ExchangeValueRepository repository<\/b> \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>  4. <b>ExchangeValue exchangeValue = repository.findByFromAndTo(from, to)<\/b> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u0430 \u043e\u0431\u043c\u0435\u043d\u0430 \u0432\u0430\u043b\u044e\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  5. <b>exchangeValue.setPort(Integer.parseInt(environment.getProperty(\u00ablocal.server.port\u00bb))) <\/b> <\/p>\n<p>  &nbsp;&nbsp;&nbsp; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u043e\u0440\u0442 (port) \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 environment \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0431\u0438\u043d \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Application Name \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/h3>\n<p>  \/spring-boot-microservice-forex-service\/src\/main\/resources\/application.properties<\/p>\n<pre><code class=\"java\">spring.application.name=forex-service server.port=8000  spring.jpa.show-sql=true spring.h2.console.enabled=true<\/code><\/pre>\n<p>  \u041d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u043e\u0440\u0442 8000 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<h3>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 data.sql<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0437\u0434\u0430\u0432 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <b>data.sql<\/b>. <b>Spring Boot Auto Configuration<\/b> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \/spring-boot-microservice-forex-service\/src\/main\/resources\/data.sql<\/p>\n<pre><code class=\"sql\">insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10001,'USD','INR',65,0); insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10002,'EUR','INR',75,0); insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10003,'AUD','INR',25,0);<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c Forex \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441<\/h3>\n<p>  <\/p>\n<pre><code class=\"xml\">GET to http:\/\/localhost:8000\/currency-exchange\/from\/EUR\/to\/INR<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"json\">{   id: 10002,   from: &quot;EUR&quot;,   to: &quot;INR&quot;,   conversionMultiple: 75,   port: 8000, }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0430\u043b\u0435\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439:<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442 CCS. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 REST \u0441\u0435\u0440\u0432\u0438\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Feign \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 Forex.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Ribbon \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/li>\n<li>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 Eureka Naming Service \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 FS \u0438 CCS \u0447\u0435\u0440\u0435\u0437 Eureka.<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<h4>\/spring-boot-microservice-forex-service\/pom.xml<\/h4>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot; xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;   xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;   &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;    &lt;groupId&gt;com.in28minutes.springboot.microservice.example.forex&lt;\/groupId&gt;   &lt;artifactId&gt;spring-boot-microservice-forex-service&lt;\/artifactId&gt;   &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;   &lt;packaging&gt;jar&lt;\/packaging&gt;    &lt;name&gt;spring-boot-microservice-forex-service&lt;\/name&gt;   &lt;description&gt;Microservices with Spring Boot and Spring Cloud - Forex Service&lt;\/description&gt;    &lt;parent&gt;     &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;     &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;     &lt;version&gt;2.0.0.RELEASE&lt;\/version&gt;     &lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;   &lt;\/parent&gt;    &lt;properties&gt;     &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;     &lt;project.reporting.outputEncoding&gt;UTF-8&lt;\/project.reporting.outputEncoding&gt;     &lt;java.version&gt;1.8&lt;\/java.version&gt;     &lt;spring-cloud.version&gt;Finchley.M8&lt;\/spring-cloud.version&gt;   &lt;\/properties&gt;    &lt;dependencies&gt;     &lt;dependency&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;     &lt;\/dependency&gt;     &lt;dependency&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;     &lt;\/dependency&gt;      &lt;dependency&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-devtools&lt;\/artifactId&gt;       &lt;scope&gt;runtime&lt;\/scope&gt;     &lt;\/dependency&gt;     &lt;dependency&gt;       &lt;groupId&gt;com.h2database&lt;\/groupId&gt;       &lt;artifactId&gt;h2&lt;\/artifactId&gt;       &lt;scope&gt;runtime&lt;\/scope&gt;     &lt;\/dependency&gt;     &lt;dependency&gt;       &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;       &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;       &lt;scope&gt;test&lt;\/scope&gt;     &lt;\/dependency&gt;   &lt;\/dependencies&gt;    &lt;dependencyManagement&gt;     &lt;dependencies&gt;       &lt;dependency&gt;         &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;         &lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;         &lt;version&gt;${spring-cloud.version}&lt;\/version&gt;         &lt;type&gt;pom&lt;\/type&gt;         &lt;scope&gt;import&lt;\/scope&gt;       &lt;\/dependency&gt;     &lt;\/dependencies&gt;   &lt;\/dependencyManagement&gt;    &lt;build&gt;     &lt;plugins&gt;       &lt;plugin&gt;         &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;         &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;       &lt;\/plugin&gt;     &lt;\/plugins&gt;   &lt;\/build&gt;    &lt;repositories&gt;     &lt;repository&gt;       &lt;id&gt;spring-snapshots&lt;\/id&gt;       &lt;name&gt;Spring Snapshots&lt;\/name&gt;       &lt;url&gt;https:\/\/repo.spring.io\/snapshot&lt;\/url&gt;       &lt;snapshots&gt;         &lt;enabled&gt;true&lt;\/enabled&gt;       &lt;\/snapshots&gt;     &lt;\/repository&gt;     &lt;repository&gt;       &lt;id&gt;spring-milestones&lt;\/id&gt;       &lt;name&gt;Spring Milestones&lt;\/name&gt;       &lt;url&gt;https:\/\/repo.spring.io\/milestone&lt;\/url&gt;       &lt;snapshots&gt;         &lt;enabled&gt;false&lt;\/enabled&gt;       &lt;\/snapshots&gt;     &lt;\/repository&gt;   &lt;\/repositories&gt;    &lt;pluginRepositories&gt;     &lt;pluginRepository&gt;       &lt;id&gt;spring-snapshots&lt;\/id&gt;       &lt;name&gt;Spring Snapshots&lt;\/name&gt;       &lt;url&gt;https:\/\/repo.spring.io\/snapshot&lt;\/url&gt;       &lt;snapshots&gt;         &lt;enabled&gt;true&lt;\/enabled&gt;       &lt;\/snapshots&gt;     &lt;\/pluginRepository&gt;     &lt;pluginRepository&gt;       &lt;id&gt;spring-milestones&lt;\/id&gt;       &lt;name&gt;Spring Milestones&lt;\/name&gt;       &lt;url&gt;https:\/\/repo.spring.io\/milestone&lt;\/url&gt;       &lt;snapshots&gt;         &lt;enabled&gt;false&lt;\/enabled&gt;       &lt;\/snapshots&gt;     &lt;\/pluginRepository&gt;   &lt;\/pluginRepositories&gt;   &lt;\/project&gt;<\/code><\/pre>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/ExchangeValue.java<\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">package com.in28minutes.springboot.microservice.example.forex; import java.math.BigDecimal;  import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id;  @Entity public class ExchangeValue {      @Id   private Long id;      @Column(name=&quot;currency_from&quot;)   private String from;      @Column(name=&quot;currency_to&quot;)   private String to;      private BigDecimal conversionMultiple;   private int port;      public ExchangeValue() {        }       public ExchangeValue(Long id, String from, String to, BigDecimal conversionMultiple) {     super();     this.id = id;     this.from = from;     this.to = to;     this.conversionMultiple = conversionMultiple;   }    public Long getId() {     return id;   }    public String getFrom() {     return from;   }    public String getTo() {     return to;   }    public BigDecimal getConversionMultiple() {     return conversionMultiple;   }      public int getPort() {     return port;   }    public void setPort(int port) {     this.port = port;   }  }<\/code><\/pre>\n<p>  <\/p>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/ExchangeValueRepository.java<br \/>  <\/h4>\n<p>package com.in28minutes.springboot.microservice.example.forex;  <\/p>\n<pre><code class=\"java\">import org.springframework.data.jpa.repository.JpaRepository;  public interface ExchangeValueRepository extends      JpaRepository&lt;ExchangeValue, Long&gt;{   ExchangeValue findByFromAndTo(String from, String to); }<\/code><\/pre>\n<p>  <\/p>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/ForexController.java<br \/>  <\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">package com.in28minutes.springboot.microservice.example.forex; import java.math.BigDecimal;  import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController;  @RestController public class ForexController {      @Autowired   private Environment environment;      @Autowired   private ExchangeValueRepository repository;      @GetMapping(&quot;\/currency-exchange\/from\/{from}\/to\/{to}&quot;)   public ExchangeValue retrieveExchangeValue     (@PathVariable String from, @PathVariable String to){          ExchangeValue exchangeValue =          repository.findByFromAndTo(from, to);          exchangeValue.setPort(         Integer.parseInt(environment.getProperty(&quot;local.server.port&quot;)));          return exchangeValue;   } }<\/code><\/pre>\n<p>  <\/p>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/SpringBootMicroserviceForexServiceApplication.java<br \/>  <\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">package com.in28minutes.springboot.microservice.example.forex;  import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;  @SpringBootApplication public class SpringBootMicroserviceForexServiceApplication {    public static void main(String[] args) {     SpringApplication.run(SpringBootMicroserviceForexServiceApplication.class, args);   } }<\/code><\/pre>\n<p>  <\/p>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/resources\/application.properties<\/h4>\n<p>  <\/p>\n<pre><code class=\"xml\">spring.application.name=forex-service server.port=8000  spring.jpa.show-sql=true spring.h2.console.enabled=true<\/code><\/pre>\n<h4>\/spring-boot-microservice-forex-service\/src\/main\/resources\/data.sql<\/h4>\n<p>  <\/p>\n<pre><code class=\"sql\">insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10001,'USD','INR',65,0); insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10002,'EUR','INR',75,0); insert into exchange_value(id,currency_from,currency_to,conversion_multiple,port) values(10003,'AUD','INR',25,0);<\/code><\/pre>\n<p>  <\/p>\n<h4>\/spring-boot-microservice-forex-service\/src\/test\/java\/com\/in28minutes\/springboot\/microservice\/example\/forex\/SpringBootMicroserviceForexServiceApplicationTests.java<\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">package com.in28minutes.springboot.microservice.example.forex;  import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;  @RunWith(SpringRunner.class) @SpringBootTest public class SpringBootMicroserviceForexServiceApplicationTests {    @Test   public void contextLoads() {   }  }<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<\/div>\n<p> \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\/post\/484864\/\"> https:\/\/habr.com\/ru\/post\/484864\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/484864\/\">\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Boot \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Spring MVC, JPA, Hibernate \u0438 H2.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0432\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u0441\u044c \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spring Boot \u0438 Spring Cloud.<\/p>\n<p>  \u042d\u0442\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u044b \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441\u043e Spring Boot.<\/p>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u0440\u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0438\u0445 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u043c\u0435\u043d Eureka (Eureka Naming Server) \u0438 Ribbon \u0434\u043b\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.  <\/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-297506","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297506","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=297506"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297506\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}