{"id":815,"date":"2020-03-30T14:00:00","date_gmt":"2020-03-30T14:00:00","guid":{"rendered":"http:\/\/bullyrooks.com\/index.php\/2020\/04\/10\/simple-spring-boot-service-to-kubernetes-application-step-14-8e1ade0b7b84\/"},"modified":"2021-02-04T02:02:20","modified_gmt":"2021-02-04T02:02:20","slug":"simple-spring-boot-service-to-kubernetes-application-step-14-8e1ade0b7b84","status":"publish","type":"post","link":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-14-8e1ade0b7b84\/","title":{"rendered":"System Design"},"content":{"rendered":"\n<p class=\"graf graf--p graf-after--h3 graf--trailing\" id=\"8623\">We\u2019ve successfully deployed a service and confirmed that its accessible. However, a single service doesn\u2019t make an app. We now need to fill out the rest of the application and introduce some best practices around service governance and system engineering.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf--leading wp-block-heading\" id=\"bf3d\">The Application Design<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/02\/16JoUwP9Xpr4F1QXpNhczeg.png?w=960\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p class=\"graf graf--p graf-after--figure\" id=\"e78d\">We\u2019re going to be organizing the UI as microUI applications that interact directly with services specific to their function. This will give us flexibility in terms of evolving our enterprise application functionality. Additionally, each service will publish a message reflecting a change to the state of the data maintained by that service.<\/p>\n\n\n\n<p class=\"graf graf--p graf-after--p\" id=\"ec6f\">We will be able to move between UI application contexts because we\u2019ll be using OAuth and will configure our application to recognize the token across contexts.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf-after--p wp-block-heading\" id=\"d4b9\">First Steps<\/h3>\n\n\n\n<p class=\"graf graf--p graf-after--h3\" id=\"fe1e\">We\u2019re going to be using our initial service as a template for the new development. However, even though we\u2019ve done a lot of work here to get it into a \u2018good\u2019 place, there are still some gaps that we\u2019ll want to patch before we use it as a good example.<\/p>\n\n\n\n<h4 class=\"graf graf--h4 graf-after--p wp-block-heading\" id=\"773a\">Validate Customer Existence<\/h4>\n\n\n\n<p class=\"graf graf--p graf-after--h4\" id=\"cded\">We knew that we are not handling duplicate customer creation requests consistently across platforms (different databases handle the request differently). We want to manage this better with this flow:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/02\/16JoUwP9Xpr4F1QXpNhczeg.png?w=960\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<h4 class=\"graf graf--h4 graf-after--figure wp-block-heading\" id=\"a65f\">Return Existing Customers<\/h4>\n\n\n\n<p class=\"graf graf--p graf-after--h4\" id=\"8ad3\">We probably also want the ability to return a single user as well as a list of all users. So we want to add these flows as well:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/02\/16JoUwP9Xpr4F1QXpNhczeg.png?w=960\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2021\/02\/16JoUwP9Xpr4F1QXpNhczeg.png?w=960\" alt=\"\" data-recalc-dims=\"1\"\/><\/figure>\n\n\n\n<p class=\"graf graf--p graf-after--figure\" id=\"8ddb\">Implementing all of this should be fairly straightforward based on our current codebase. The only thing that is unique is the updates to <code class=\"markup--code markup--p-code\">CustomerDAO<\/code>:<\/p>\n\n\n\n<pre id=\"99a0\" class=\"wp-block-code graf graf--pre graf-after--p\"><code>Optional&lt;CustomerEntity&gt; findByEmail(String email);<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote graf graf--blockquote graf-after--pre is-layout-flow wp-block-quote-is-layout-flow\" id=\"d4c5\"><p>This is <a class=\"markup--anchor markup--blockquote-anchor\" href=\"https:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/reference\/html\/#jpa.query-methods.query-creation\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/docs.spring.io\/spring-data\/jpa\/docs\/current\/reference\/html\/#jpa.query-methods.query-creation\">spring\u2019s JPA convention<\/a>. By using their method naming convention spring can generate the JPQL for you.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\">\nWe\u2019ve successfully deployed a service and confirmed that its accessible. However, a&hellip;\n<\/div>\n<div class=\"link-more\"><a href=\"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-14-8e1ade0b7b84\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &ldquo;System Design&rdquo;<\/span>&hellip;<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[89,87,55],"course":[40],"class_list":["post-815","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-design","tag-distributed-services","tag-microservice","course-spring-with-kubernetes","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1333,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/02\/27\/kube-cloud-pt5-create-a-consumer-service\/","url_meta":{"origin":815,"position":0},"title":"Kube Cloud Pt5 | Create a Consumer Service","author":"Bullyrook","date":"February 27, 2022","format":false,"excerpt":"In this course we're going to migrate the repository storage function out of cloud-application and migrate it into a new service called message-repository. Although this is a relatively minor change in behavior (in exchange for a significant effort), there are some real world benefits that this example will provide cloud-application\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/pg1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/pg1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/02\/pg1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":832,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-22-e37d26471e9e\/","url_meta":{"origin":815,"position":1},"title":"Conclusion and Review","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Up to this point we\u2019ve been writing, testing, building, deploying and integrating services. Lets take a moment to reflect on what we have accomplished and why. Here we are at 22 articles in. That seems like a lot, but I wanted to write these articles in an easily ingested way\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":837,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-8-3e94686c9a34\/","url_meta":{"origin":815,"position":2},"title":"Containerize the Service With Docker","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Now we\u2019re going to take our functional service and containerize it. This will allow us to control the deployment environment that our java spring boot service runs in as well as provide some additional security and isolation from application updates that can break our application. Containerization Overview If you\u2019ve spent\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1141,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/02\/kubernetes-application-hosted-in-the-cloud\/","url_meta":{"origin":815,"position":3},"title":"Kubernetes Application Hosted in the Cloud","author":"Bullyrook","date":"January 2, 2022","format":false,"excerpt":"It's been a few years since my last spring boot based kubernetes application. That course ended with a microservice deployed into kubernetes via minikube locally. I'm using this course to expand on that effort. In this course I'm going to show a few ways to do the same things in\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":828,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-4-dba10da3d834\/","url_meta":{"origin":815,"position":4},"title":"Create a REST Controller","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"In this article we\u2019re going to take the service layer we created in the last step and add a REST interface to it. We\u2019re going to follow the hexagonal design principles we previously discussed and add a functional or component test and explain how those test work and why they\u2019re\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":819,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-3-f03bdfe30ceb\/","url_meta":{"origin":815,"position":5},"title":"Building a Service Layer","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"In this stage we\u2019re going to build out the service or logical layer of our microservice. I\u2019ll explain adapter and port or hexagonal architecture and covering the usage of mapstruct. Service Design Ports and adapter or hexagonal design is a well discussed concept, so I\u2019m not going to go into\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/comments?post=815"}],"version-history":[{"count":3,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/815\/revisions"}],"predecessor-version":[{"id":903,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/815\/revisions\/903"}],"wp:attachment":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/media?parent=815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/categories?post=815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/tags?post=815"},{"taxonomy":"course","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/course?post=815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}