<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yiğitcan Nalcı on Medium]]></title>
        <description><![CDATA[Stories by Yiğitcan Nalcı on Medium]]></description>
        <link>https://medium.com/@yigitcannalci?source=rss-bf5808bbc9ae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*EEsrfsAudwu6IvFuQx2-xA.jpeg</url>
            <title>Stories by Yiğitcan Nalcı on Medium</title>
            <link>https://medium.com/@yigitcannalci?source=rss-bf5808bbc9ae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 14:18:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yigitcannalci/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Power of Technology Agnosticism in Software Development]]></title>
            <link>https://medium.com/@yigitcannalci/the-power-of-technology-agnosticism-in-software-development-5be0ab4ce5d1?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/5be0ab4ce5d1</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering-principles]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Sun, 20 Aug 2023 12:43:56 GMT</pubDate>
            <atom:updated>2023-08-20T12:43:56.453Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In the fast-paced world of software development, staying current with the latest technologies and tools is essential. However, there’s a growing movement that challenges the idea of blind allegiance to specific technologies: technology agnosticism. This approach advocates for choosing the best tools for the job at hand, regardless of personal bias or the current industry trends. In this article, we’ll delve into the concept of technology agnosticism and explore its benefits for modern software development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0jAsLFhRrTQWiFd4" /><figcaption>Photo by <a href="https://unsplash.com/@wocintechchat?utm_source=medium&amp;utm_medium=referral">Christina @ wocintechchat.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Fallacy of One-Size-Fits-All Solutions</h3><p>In the quest for efficiency, it’s easy to fall into the trap of believing that a single technology stack or framework can solve all problems. However, every project is unique, with its own set of requirements, constraints, and challenges. Embracing technology agnosticism means acknowledging that no single tool can address every scenario optimally.</p><p>By adopting a technology-agnostic mindset, developers free themselves from the limitations of a predetermined technology stack. This approach encourages exploration and experimentation, leading to more innovative solutions that are tailored to the project’s specific needs.</p><h3>Flexibility and Adaptability</h3><p>Software development is a rapidly evolving field, with new technologies and tools emerging regularly. Being technology agnostic equips developers with the ability to adapt to these changes more seamlessly. Rather than being tied to a particular technology that may become outdated or less suitable, technology-agnostic developers can pivot quickly and integrate new tools as needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FiNkQd1JFyS9EreP" /><figcaption>Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&amp;utm_medium=referral">Brett Jordan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This adaptability is particularly valuable in situations where project requirements evolve or unexpected challenges arise. By selecting tools based on their relevance and effectiveness, developers can avoid unnecessary roadblocks and delays.</p><h3>Problem-Centric Approach</h3><p>At the core of technology agnosticism lies a problem-centric approach. Instead of beginning a project by choosing a technology stack and then adapting the problem to fit that stack, developers who embrace technology agnosticism start by thoroughly understanding the problem at hand. They then choose technologies that best align with the problem’s unique characteristics and requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IbRl1rHybplPMaZm" /><figcaption>Photo by <a href="https://unsplash.com/@epicantus?utm_source=medium&amp;utm_medium=referral">Daria Nepriakhina 🇺🇦</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This approach encourages deeper problem-solving and prevents developers from trying to force a solution that doesn’t quite fit. By keeping the focus on the problem itself, technology-agnostic developers are more likely to arrive at elegant and efficient solutions.</p><h3>Collaboration and Interoperability</h3><p>Technology agnosticism fosters a collaborative environment where developers are open to different ideas and perspectives. When personal bias towards a specific technology is set aside, discussions become centered around the best way to solve a problem rather than which technology to use. This encourages healthy debates and knowledge sharing, ultimately leading to better solutions.</p><p>Furthermore, technology agnosticism promotes interoperability. Projects often require integrating with existing systems or third-party services that may not align with a developer’s preferred stack. By being open to various technologies, developers can more easily create seamless integrations and improve overall system compatibility.</p><h3>Overcoming the Fear of the Unknown</h3><p>One of the challenges developers face when adopting technology agnosticism is the fear of the unknown. It can be intimidating to step outside one’s comfort zone and explore unfamiliar technologies. However, this fear is often outweighed by the excitement of learning and the satisfaction of crafting effective solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qDI4khvic78PBP1D" /><figcaption>Photo by <a href="https://unsplash.com/@benjaminwedemeyer?utm_source=medium&amp;utm_medium=referral">Benjamin Wedemeyer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Developers can gradually overcome this fear by dedicating time to learning about different technologies, attending workshops, and collaborating with colleagues who have expertise in diverse areas. Over time, this exposure can lead to increased confidence and a broader skill set.</p><h3>Conclusion</h3><p>In a world where technology trends come and go, and the software development landscape is in a constant state of flux, technology agnosticism offers a stable foundation for innovation. By prioritizing problem-solving over personal preferences and staying open to a diverse range of tools, developers can create solutions that are not only effective but also adaptable to the ever-changing demands of the industry. Embracing technology agnosticism is a mindset shift that empowers developers to navigate the dynamic world of software development with confidence and creativity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5be0ab4ce5d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Microservices Architecture: Is it good or bad?]]></title>
            <link>https://blog.stackademic.com/exploring-microservices-architecture-is-it-good-or-bad-c29b45802c98?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/c29b45802c98</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[microservices-pattern]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 17:01:55 GMT</pubDate>
            <atom:updated>2023-08-17T09:01:16.766Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>In the ever-evolving landscape of software development, microservices architecture has gained significant attention as a robust and flexible approach to designing and building complex applications. <strong>Microservices</strong> offer a departure from the traditional monolithic architecture by breaking down applications into smaller, manageable, and loosely coupled components. This article delves into the fundamental concepts of microservices architecture, its benefits, challenges, and key considerations for successful implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AqzWOjrxN7Cz8uZp" /><figcaption>Photo by <a href="https://unsplash.com/@federicorespini?utm_source=medium&amp;utm_medium=referral">Federico Respini</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Understanding Microservices Architecture</h3><p>Microservices architecture is an architectural style where an application is composed of multiple small, independent services that communicate with each other over a network. <strong>You can see architectural differences in the below image. </strong>Each service represents a specific business capability and can be developed, deployed, and scaled independently. This modular approach allows developers to focus on specific functionalities, making it easier to maintain, update, and scale the application as needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i8Vz-NTJP-z05jfY" /><figcaption>Figure from <a href="https://lightstep.com/">lightstep.com</a></figcaption></figure><h3>Benefits of Microservices Architecture</h3><p><strong>Scalability:</strong> Microservices enable horizontal scaling by allowing individual services to be scaled independently. This elasticity ensures efficient resource utilization and better responsiveness during traffic spikes.</p><p><strong>Flexibility and Agility:</strong> Microservices promote agility in development, as each service can be developed, tested, and deployed independently. This facilitates faster feature delivery and easier adaptation to changing requirements.</p><p><strong>Isolation and Fault Tolerance:</strong> Since services are isolated from each other, issues in one service do not necessarily affect the entire application. This isolation enhances fault tolerance and makes it easier to identify and fix problems.</p><p><strong>Technology Diversity:</strong> Microservices allow for the use of different technologies and programming languages for different services, enabling teams to choose the best tools for specific tasks.</p><p><strong>Team Autonomy:</strong> Microservices architecture supports decentralized development teams, where each team can own and manage a specific service. This autonomy fosters innovation and specialization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3oc90Nu9L6obrsFo" /><figcaption>Photo by <a href="https://unsplash.com/@perotto?utm_source=medium&amp;utm_medium=referral">Alexandre Perotto</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Challenges of Microservices Architecture</h3><p><strong>The complexity of Communication:</strong> As services communicate over a network, designing effective communication mechanisms becomes crucial. Implementing resilient communication and handling failures require careful planning.</p><p><strong>Data Management:</strong> Maintaining data consistency and integrity across distributed services can be challenging. Techniques like event sourcing and distributed databases are often employed to address these issues.</p><p><strong>Operational Overhead:</strong> Managing a larger number of services can lead to increased operational complexity, including monitoring, deployment, and version control.</p><p><strong>Testing and Deployment:</strong> Testing the interactions between services and coordinating their deployment requires comprehensive strategies and automated tools<strong>.</strong></p><p><strong>Service Discovery:</strong> Services need a way to discover and communicate with each other. Implementing reliable service discovery mechanisms is essential for seamless operation.</p><h3>Implementing Microservices Architecture</h3><p><strong>Domain Decomposition:</strong> Identify and decompose the application’s domain into distinct services, ensuring each service focuses on a specific business capability.</p><p><strong>API Design:</strong> Design clear and standardized APIs for communication between services. RESTful APIs and messaging protocols like MQTT or AMQP are common choices.</p><p><strong>Deployment Strategy:</strong> Choose appropriate deployment strategies, such as containerization with technologies like Docker and orchestration with Kubernetes.</p><p><strong>Monitoring and Logging:</strong> Implement robust monitoring and logging practices to gain insights into the performance and behavior of individual services.</p><p><strong>Continuous Integration and Deployment (CI/CD):</strong> Adopt CI/CD pipelines to automate testing, integration, and deployment processes, ensuring efficient delivery of new features and bug fixes.</p><h3>Conclusion</h3><p>Microservices architecture offers a compelling solution to the challenges of building and maintaining complex applications. Its benefits in terms of scalability, agility, and fault tolerance make it an attractive choice for modern software development. However, adopting microservices requires careful planning and a deep understanding of the associated challenges. By considering the architecture’s principles and implementing best practices, development teams can leverage microservices to create robust, scalable, and maintainable applications that meet the demands of today’s dynamic technology landscape.</p><p><em>Thank you for reading until the end. Please consider following the writer and this publication. Visit </em><a href="https://stackademic.com/"><strong><em>Stackademic</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c29b45802c98" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/exploring-microservices-architecture-is-it-good-or-bad-c29b45802c98">Exploring Microservices Architecture: Is it good or bad?</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reactive Programming (Part 2)]]></title>
            <link>https://medium.com/javarevisited/reactive-programming-part-2-43f73f43ee68?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/43f73f43ee68</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[reactivex]]></category>
            <category><![CDATA[spring-webflux]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Sat, 13 Aug 2022 18:38:58 GMT</pubDate>
            <atom:updated>2023-08-18T16:53:04.177Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi again, I hope all is well! I feel happy with the photo below, I suggest that to feel the same with me, take a deep breath and look at the photo 😄.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VonfIABi74zvC5FS" /><figcaption>Photo by <a href="https://unsplash.com/@aaronburden?utm_source=medium&amp;utm_medium=referral">Aaron Burden</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As I said before, I am here with a practical coding example of Reactive Programming.</p><figure><a href="https://javarevisited.blogspot.com/2021/04/best-reactive-spring-and-webflux-courses-for-java-developers.html"><img alt="" src="https://cdn-images-1.medium.com/max/748/1*cisZxOoCoj8ScssoohGQCQ.jpeg" /></a><figcaption>Figure from <a href="https://spring.io/reactive">https://spring.io</a></figcaption></figure><p>In this tutorial, I will explain <em>“how to develop a reactive mail service with </em><a href="https://medium.com/javarevisited/7-best-webflux-and-reactive-spring-boot-courses-for-java-programmers-33b7c6fa8995"><em>Spring WebFlux</em></a><em> and </em><a href="https://medium.com/javarevisited/10-free-online-courses-to-learn-mongodb-and-nosql-942609611664"><em>MongoDB</em></a><em>”</em>.</p><h3>Technologies and Tools</h3><p>The tutorial here uses <a href="https://medium.com/javarevisited/7-best-courses-to-learn-intellij-idea-for-beginners-and-experienced-java-programmers-2e9aa9bb0c05">IntelliJ IDEA</a>, <a href="https://medium.com/javarevisited/6-best-maven-courses-for-beginners-in-2020-23ea3cba89">Maven</a>, and <a href="https://medium.com/javarevisited/7-best-courses-to-learn-postman-tool-for-web-service-and-api-testing-f225c138fa5a">Postman </a>for coding, building, and REST API testing. I’m running on MacOS Monterey.</p><p>All software is written in Java, with Spring Boot 2.6.2. <a href="https://www.mongodb.com/">MongoDB</a> 4.2 Community Server is used for persistence.</p><p>From here, I’ll assume you have JDK 17.0, IntelliJ, Maven, <a href="https://medium.com/javarevisited/10-free-online-courses-to-learn-mongodb-and-nosql-942609611664">MongoDB</a>, and <a href="https://javarevisited.blogspot.com/2020/02/top-5-postman-tutorials-and-courses-for-web-developers.html">Postman </a>installed.</p><h3>Reactive Mail Service</h3><p>This <a href="https://medium.com/javarevisited/10-best-java-microservices-courses-with-spring-boot-and-spring-cloud-6d04556bdfed">microservice </a>provides two endpoints. First, for sending simple emails and for sending emails with attachments. Also, this service saves the email’s data to the <a href="https://javarevisited.blogspot.com/2019/01/top-5-mongodb-online-training-courses.html#axzz7E4Jl2a5D">MongoDB database</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A0LGqmOo_x3_mstF" /><figcaption>Photo by <a href="https://unsplash.com/@solenfeyissa?utm_source=medium&amp;utm_medium=referral">Solen Feyissa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>My goal here is to show how the REST services will be developed using these technologies in a simple way without shuffling the business logic.</p><ul><li>A POST operation is used to send an email.</li><li>Another POST operation is used to send emails with attachments.</li><li>Everything stored, received, and returned by the service is formatted as <a href="https://javarevisited.blogspot.com/2017/02/how-to-consume-json-from-restful-web-services-Spring-RESTTemplate-Example.html">JSON</a>.</li></ul><h4>MailDocument Model</h4><p>This model has 6 fields: id, from, to, cc, bcc, time and MailDocument is used to save data to the database.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ef7bf0dec853f4837820a668d944bfc/href">https://medium.com/media/6ef7bf0dec853f4837820a668d944bfc/href</a></iframe><h4>Mail Repository</h4><p>You can easily create an interface extending <em>ReactiveMongoRepository </em>using <a href="https://medium.com/javarevisited/5-best-spring-data-jpa-courses-for-java-developers-45e6438be3c9">Spring Data Project</a>. With this, there is no need to implement this interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f4052f269a067ee3bed530db33a7f2c/href">https://medium.com/media/3f4052f269a067ee3bed530db33a7f2c/href</a></iframe><p>It is important to use <em>ReactiveMongoRepository</em> instead of <em>MongoRepository</em> because, with this interface, we provide reactiveness from presentation to persistence.</p><h4>Mail Service</h4><p>The mail service has two public and five private methods. Simply, these methods provide sending emails with or without attachments. After s<a href="https://javarevisited.blogspot.com/2014/08/how-to-send-email-from-java-program-example.html">ending emails</a>, email data is saved to the MongoDB database.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5390e443ac5d7e7123544de43f8ee802/href">https://medium.com/media/5390e443ac5d7e7123544de43f8ee802/href</a></iframe><h4>Mail Controller</h4><p><em>MailController.java </em>is a <a href="https://javarevisited.blogspot.com/2017/08/difference-between-restcontroller-and-controller-annotations-spring-mvc-rest.html">REST controller</a> which has two @PostMapping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/421aa7330791855bfd18f4295ee094a1/href">https://medium.com/media/421aa7330791855bfd18f4295ee094a1/href</a></iframe><h4>Database Configuration</h4><p>You need to start MongoDB once to connect to the database. You can write the below command if you use <a href="https://brew.sh/#install">brew</a>.</p><pre>brew services start mongodb-community@4.2</pre><p>If you see this message on the terminal window, you are on the right way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6qurqHVBQjVBvXeffhA7-w.png" /></figure><p>To connect to the <a href="https://medium.com/javarevisited/5-best-nosql-database-programmers-and-developers-can-learn-42a0bdfa9a12">MongoDB database</a>, edit the settings in the <em>“application.properties”</em> file which is part of <em>“resources”</em>. The following configurations are sufficient.</p><pre>#mongodb<br>spring.data.mongodb.host=localhost<br>spring.data.mongodb.port=27017<br>spring.data.mongodb.database=test</pre><h3>Running the Service and Testing with Postman</h3><p>You can easily run this project to test the REST endpoints.</p><figure><a href="https://javarevisited.blogspot.com/2020/05/top-20-spring-boot-interview-questions-answers.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qazz01yQBtSjqM8053R2Bg.png" /></a><figcaption>Run the project in IntelliJ</figcaption></figure><p>After running the project, you can test the <a href="https://medium.com/javarevisited/10-best-java-web-services-rest-soap-and-api-courses-for-beginners-724a8f51298d">REST service</a>. For this, open Postman, enter the URL and select <strong>POST</strong> method like below.</p><figure><a href="https://javarevisited.blogspot.com/2021/10/top-5-courses-to-learn-api-development.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdMkUl0faCbHwShfjhhYAg.png" /></a><figcaption>Send an email</figcaption></figure><p>You can send an email to the specified email adress <strong>POST</strong> method in Postman. First, you should enter <strong><em>Content-Type : application/json</em></strong> header key-value pair. Second, in the body tab, you must enter the email information that you want to save the database in <a href="https://javarevisited.blogspot.com/2022/03/3-examples-to-parse-json-in-java-using.html">JSON format</a>.</p><figure><a href="https://www.java67.com/2016/10/3-ways-to-convert-string-to-json-object-in-java.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*moVp5SZNdqFmpmq1QdP4uA.png" /></a><figcaption>Email sent</figcaption></figure><p>By the way, you can also test the other <a href="https://javarevisited.blogspot.com/2016/10/difference-between-put-and-post-in-restful-web-service.html"><strong>POST </strong>method</a> by providing accurate <a href="https://www.java67.com/2019/09/3-ways-to-ignore-null-fields-in-json-java-jackson.html">JSON objects</a>.</p><p><strong>Note: </strong>This tutorial focuses on the combination of Spring Data, Spring WebFlux, MongoDB and REST API. There is no validation for object fields in the project.</p><h3>Resources</h3><ul><li><a href="https://reactivex.io/">https://reactivex.io/</a></li><li><a href="https://www.reactivemanifesto.org/">https://www.reactivemanifesto.org/</a></li><li><a href="https://spring.io/">https://spring.io/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43f73f43ee68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/reactive-programming-part-2-43f73f43ee68">Reactive Programming (Part 2)</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reactive Programming (Part 1)]]></title>
            <link>https://medium.com/javarevisited/reactive-programming-part-1-a3fb88e6c8d8?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3fb88e6c8d8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[non-blocking]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 12:59:58 GMT</pubDate>
            <atom:updated>2022-08-13T18:48:57.826Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, there was a big change in my life when I couldn’t write. I have a daughter 👨‍👩‍👧, I mean, I am a father now 😎. It took some time to adapt new life as a family, but we are all happy right now 👨‍👩‍👧 and I have a time to write something good 😁.</p><p>So getting back to my story, <a href="https://javarevisited.blogspot.com/2021/04/best-reactive-spring-and-webflux-courses-for-java-developers.html"><em>Reactive Programming</em></a> is one of the most popular paradigm recently.</p><p>Its popularity comes from <strong><em>non-blocking I/O</em></strong> concept. This concept describes that while a code block is running, it doesn’t block any other threads. In short, two processes can work without blocking each other.</p><p>Let’s dig in! 🦽🦼</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y3cbSbviCzsts2ML" /><figcaption>Photo by <a href="https://unsplash.com/@phorgod?utm_source=medium&amp;utm_medium=referral">Abbas Tehrani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is Reactive Programming?</h4><blockquote>An API for asynchronous programming with observable streams.</blockquote><p>Our programs developed according to <a href="https://medium.com/swlh/5-free-object-oriented-programming-online-courses-for-programmers-156afd0a3a73"><em>Object Oriented Programming</em></a><em>(OOP) </em>follow the flow of lines of code.<em> </em>Therefore, they are insufficient for working with side effects.</p><p>At this point, we need something else that capable of working with these side effects. Here, we call applications or code snippets that are designed to respond to these side effects as <em>Reactive</em>.</p><figure><a href="https://javarevisited.blogspot.com/2018/07/10-object-oriented-design-principles.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tCoTDdEsAHcz6eKH" /></a><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Reactive programs follow <em>events </em>instead of the flow of lines of code while the application is running.</p><p>Reactive systems must have the following features:</p><ul><li><strong>Responsive: </strong>A reactive system gives a response for all requests in a fair time.</li><li><strong>Resilient:</strong> A reactive system still handles requests even if it crashes.</li><li><strong>Elastic:</strong> A reactive system must be responsive under heavy loads.</li><li><strong>Message Driven:</strong> A reactive system uses asynchronous message passing to interact.</li></ul><figure><a href="https://www.java67.com/2016/07/top-5-object-oriented-design-interview-questions.html"><img alt="" src="https://cdn-images-1.medium.com/max/859/1*717-FoTwjx9F6i0hWeZ4xA.jpeg" /></a><figcaption>Figure from <a href="https://www.reactivemanifesto.org/">https://www.reactivemanifesto.org/</a></figcaption></figure><p>As you see, two code samples are given below about <a href="http://javarevisited.blogspot.sg/2012/02/what-is-blocking-methods-in-java-and.html">blocking </a>and non-blocking I/O concept.</p><pre>// Blocking<br>alert(1);<br>var value = localStorage.getItem(&#39;foo&#39;);<br>alert(2);</pre><p>The blocking sample’s output is 1,... 2 . Because localStorage blocks I/O while it is working.</p><pre>// Non-blocking<br>alert(1);<br>fetch(&#39;example.com&#39;).then(() =&gt; alert(2));<br>alert(3);</pre><p>On the other hand, the non-blocking I/O sample’s output is 1, 3,... 2 . It’s because fetch(...) does not block I/O while thread is running.</p><h4>Why Reactive Programming?</h4><p>As mentioned before, Reactive programs have an ability to answer the side effects. Also, you can handle more requests with a low number of threads.</p><p>If your application needs this ability, you should learn reactive programming.</p><p><strong>Note:</strong> This tutorial gives you a brief introduction to reactive programming. We will develop a reactive mail service using <a href="https://medium.com/@yigitcannalci/reactive-programming-part-2-43f73f43ee68">Spring WebFlux in <strong>(Part 2)</strong></a>. So, keep on reading 😄</p><h3>Resources</h3><ul><li><a href="https://reactivex.io/">https://reactivex.io/</a></li><li><a href="https://www.reactivemanifesto.org/">https://www.reactivemanifesto.org/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3fb88e6c8d8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/reactive-programming-part-1-a3fb88e6c8d8">Reactive Programming (Part 1)</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a REST Service with Spring Boot and MongoDB (Part 1)]]></title>
            <link>https://medium.com/javarevisited/building-a-rest-service-with-spring-boot-and-mongodb-part-1-2de01e4f434d?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/2de01e4f434d</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-data]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Sat, 10 Oct 2020 10:47:46 GMT</pubDate>
            <atom:updated>2022-07-07T12:20:14.287Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve decided to learn Spring Boot after using the previous versions of Spring for years. I realized that Spring Boot makes a lot of things pretty easy. Besides, it reduces the complexity of your dependencies. All you need to do is run your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QmE4Bdws8Ejlc2Hv" /><figcaption>Photo by <a href="https://unsplash.com/@jmacca88?utm_source=medium&amp;utm_medium=referral">John Mccann</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this tutorial, I will explain <em>“how to develop a REST service with Spring Boot and MongoDB”</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*Er0GMVtk_-Yh2vfgpBN2fQ.png" /></figure><ul><li><a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd?source=collection_home---4------0-----------------------">Spring Boot</a> and Spring Data projects which are used for <a href="https://medium.com/javarevisited/why-spring-is-the-best-framework-for-developing-rest-apis-in-java-784590e484a4?source=collection_home---4------0-----------------------">developing REST APIs</a> are used here.</li><li><a href="https://maven.apache.org/">Maven</a> is used to automating the build process.</li><li>A typical domain-driven development approach is used, separating model, repository, service, and controller classes.</li></ul><p>You can download the project source code from this <a href="https://github.com/ragcrix/StudentInformationSystem">GitHub </a>link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*SHY3YLupWSUAhpcm0DLRAg.png" /></figure><h4>Technologies and Tools</h4><p>The tutorial here uses <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a>, <a href="https://gradle.org/">M</a>aven, and <a href="https://www.getpostman.com/apps">Postman</a> for coding, building, and REST API testing. I’m running on <a href="https://www.microsoft.com/en-us/windows/">Windows 10</a> using PowerShell.</p><p>All software is written in Java, with Spring 5.1 and Spring Boot 2.1.4. <a href="https://www.mongodb.com/">MongoDB</a> 4.0.9 Community Server is used for persistence.</p><p>From here, I’ll assume you have JDK 8.0, <a href="https://medium.com/javarevisited/7-best-courses-to-learn-intellij-idea-for-beginners-and-experienced-java-programmers-2e9aa9bb0c05">IntelliJ</a>, <a href="https://gradle.org/">M</a>aven, <a href="https://medium.com/javarevisited/5-best-mongodb-courses-to-learn-nosql-for-beginners-in-2020-42df5af5496c">MongoDB</a>, and <a href="https://medium.com/javarevisited/7-best-courses-to-learn-postman-tool-for-web-service-and-api-testing-f225c138fa5a">Postman </a>installed.</p><h4>Student Information Service</h4><p>This REST service brings student information and allows you to add new students to the system or remove students from the system.</p><p>My goal here is to show how the REST services will be developed using these technologies in a simple way without shuffling the business logic.</p><ul><li>A POST operation is used to add students to the system.</li><li>GET operations are used to get students by student number or email. Students are also brought according to their GPAs.</li><li>The student&#39;s collection in the MongoDB database has the data about each student’s name, student number, email, course list and GPA.</li><li>Everything stored, received, and returned by the service is formatted as <a href="https://javarevisited.blogspot.com/2017/02/how-to-consume-json-from-restful-web-services-Spring-RESTTemplate-Example.html">JSON</a>.</li></ul><h3>Step 1: Spring Initialzr</h3><p>If you want to create a new Spring application, you can use the <a href="https://start.spring.io/">Spring Initalizr</a>. I entered the values for this project as in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lxv33siJImrhX2tkMLRz1Q.png" /><figcaption>Spring Initializr setup</figcaption></figure><ul><li>Select <em>Maven Project</em>, <em>Java</em>, and <em>Spring Boot 2.1.4.</em></li><li>Pick an appropriate group and artifact.</li><li>The two dependencies: <strong>MongoDB</strong> and <strong>Web</strong>.</li></ul><p>After doing that, you can download a template project as .zip file with the <strong>“Generate Project”</strong> button.</p><p>Unzip the project and import it into IntelliJ. After doing that, you will see something like the picture below.</p><figure><a href="https://dev.to/javinpaul/5-best-courses-to-learn-intellij-idea-for-java-developers-5e6n"><img alt="" src="https://cdn-images-1.medium.com/max/384/1*JJMTlGKqDjK7odGzie5jhQ.jpeg" /></a><figcaption>Project structure in IntelliJ</figcaption></figure><h3>Step 2: Model and Repository</h3><h4>Student Model</h4><p>A Student has six fields: id, name, studentNumber, email, courseList and gpa.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d56cdba41cd4547fc5df1115386a42bc/href">https://medium.com/media/d56cdba41cd4547fc5df1115386a42bc/href</a></iframe><p>@Document annotation is used for the same purpose with @Entity annotation in JPA.</p><p>For more information about Spring Data MongoDB, you can use <a href="https://docs.spring.io/spring-data/data-mongo/docs/">this link</a>. You can read the document for the version you want. For this tutorial, the version of Spring Data MongoDB is 2.1.6.</p><p>After doing that, you can add the StudentDTO class like below. We use this in the controller layer for communicating front-end or any different consumers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82b33e6041d4b7d4792b724686488009/href">https://medium.com/media/82b33e6041d4b7d4792b724686488009/href</a></iframe><h4>Student Repository</h4><p>With the Spring Data project, you will have magic when you create an interface that extends MongoRepository. The magic is shown below. There is no need to implement this interface :).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e712fb7ea0f81aba91ba5301a0fd7d1b/href">https://medium.com/media/e712fb7ea0f81aba91ba5301a0fd7d1b/href</a></iframe><p>Student repository interface has three methods. Firs two methods find the student by its student number or email. The last method sorts students according to their GPA.</p><h3>Step 3: Student Service</h3><p>Now, we create the student service that the student controller will call. The student service has six methods. Simply, these methods list students according to some criteria, save a student, update a student and delete a student.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58db9d5cc6d83ead0bfadab1ca9dcd4a/href">https://medium.com/media/58db9d5cc6d83ead0bfadab1ca9dcd4a/href</a></iframe><p>Normally, controller classes talk with the methods in repository classes directly, there is nothing wrong. But, if we need to some business logic, we should not write this code block in the <a href="https://javarevisited.blogspot.com/2017/11/difference-between-component-service.html">controller</a>. Because of this, the service layer is needed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a6e4d2d5069d09f9eed880ad7529e72f/href">https://medium.com/media/a6e4d2d5069d09f9eed880ad7529e72f/href</a></iframe><h3>Step 4: REST Controller</h3><p>Finally, we can create the<a href="https://javarevisited.blogspot.com/2017/08/difference-between-restcontroller-and-controller-annotations-spring-mvc-rest.html#ixzz6OYNB9oii"> REST controller</a>. This controller has four @GetMapping, one @PostMapping and one @DeleteMapping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc240784c184b07184f1f4783690819b/href">https://medium.com/media/cc240784c184b07184f1f4783690819b/href</a></iframe><h3>Step 5: Database Configuration</h3><p>To connect to the <a href="https://javarevisited.blogspot.com/2019/01/top-5-mongodb-online-training-courses.html">MongoDB database</a>, edit the settings in the <em>“application.properties”</em> file which is part of <em>“resources”</em>. The following configurations are sufficient because there is no authentication in the database currently.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ec69edab1815c3915c1ea1f4f0c530f/href">https://medium.com/media/9ec69edab1815c3915c1ea1f4f0c530f/href</a></iframe><h3>Running the Service and Testing with Postman</h3><p>To run the service and test it in <a href="https://javarevisited.blogspot.com/2020/02/top-5-postman-tutorials-and-courses-for-web-developers.html">Postman</a>, first, we need to run MongoDB. For this, two commands are required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*zbVEKaRkkl8BAi1yrvuaOg.png" /><figcaption><a href="https://docs.mongodb.com/manual/reference/program/mongod/"><strong>mongod</strong></a> command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*natO7Pl7ZFqMXhYmL82RPA.png" /><figcaption><a href="https://docs.mongodb.com/manual/reference/mongo-shell/"><strong>mongo</strong></a> command</figcaption></figure><p>After doing that, we can run the project to test the REST service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*wKvHA1q8q0ez8MpG3OfK_w.png" /><figcaption>Run the project</figcaption></figure><p>After running the project, you can test the REST service. For this, open Postman, enter the URL and select <strong>GET</strong> method like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBUMYrCiuAOTzpTZcYEMAg.png" /><figcaption>Empty student list</figcaption></figure><p>You can add a student to the system with <strong>POST</strong> method in Postman. First, you should enter <strong><em>Content-Type : application/json</em></strong> header key-value pair. Second, in body tab, you must enter the student information that you want to save the database in JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3P4NPFD2dAzzT3-ZIDCc5Q.png" /><figcaption>Adding a student</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCeLSq1hKojjwKzd8xnjZA.png" /><figcaption>List of students by GPA</figcaption></figure><p>If you want to delete a student, you should select <strong>DELETE</strong> method in Postman and add a student number that you want to delete to the end of the link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuOM7FQTLVUyLpC2pu8e-w.png" /><figcaption>Deleting a student</figcaption></figure><p>After doing the steps above, you should see two records in the database like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*Q0kaOYhgYD2NPq6laGLcCw.png" /><figcaption>The students collection</figcaption></figure><p><strong>Note:</strong> This tutorial focuses on the combination of Spring Data, MongoDB, and REST API. There is no validation for object fields in the project.</p><p>Please click on the link below to learn how to write a unit test using Spring Boot.</p><p><a href="https://medium.com/@yigitcannalci/writing-a-unit-test-using-spring-boot-part-2-b16847484cb9">Writing a Unit Test using Spring Boot (Part 2)</a>.</p><h3>Thank you for reading! 🙏 Your thoughts are very valuable to me. Please feel free to share. 😄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2de01e4f434d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/building-a-rest-service-with-spring-boot-and-mongodb-part-1-2de01e4f434d">Building a REST Service with Spring Boot and MongoDB (Part 1)</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dockerizing a Spring Boot Application]]></title>
            <link>https://medium.com/javarevisited/dockerizing-a-spring-boot-application-47842f7142b1?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/47842f7142b1</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Fri, 08 May 2020 22:02:02 GMT</pubDate>
            <atom:updated>2020-05-21T10:13:52.379Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings after a long break 😄, I finally got some time to explain how to dockerize a Spring Boot application.</p><p>As you know, I wrote this article first: <a href="https://medium.com/quick-code/a-brief-information-about-docker-3b34446590cd"><strong><em>“A Brief Information About Docker“</em></strong></a>.<strong><em> </em></strong>It’s better to read this article first because it contains brief information that every developer should know 💻.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DKdQxaK4PIsbMDbN" /><figcaption>Photo by <a href="https://unsplash.com/@patrickbrinksma?utm_source=medium&amp;utm_medium=referral">Patrick Brinksma</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As soon as you read the previous post, you are ready to learn to use Docker with Spring Boot.</p><p>From this point on, I will assume that you have installed Docker on your own computer.</p><p>In this tutorial, I will tell you about how to use <a href="https://medium.com/javarevisited/top-15-online-courses-to-learn-docker-kubernetes-and-aws-for-fullstack-developers-and-devops-d8cc4f16e773">Docker </a>with <a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd?source=collection_home---4------0-----------------------">Spring Boot</a> and give an example using Spring Boot and Docker.</p><ul><li>Spring Boot and Spring Data projects which is used for developing REST APIs are used here.</li><li><a href="https://maven.apache.org/">Maven</a> is used to automating the build process.</li><li>A typical domain-driven development approach is used, separating model, repository, service, and controller classes.</li></ul><p>You can download the project source code from this <a href="https://github.com/ragcrix/LibraryInformationSystem"><strong>GitHub link</strong></a><strong>.</strong></p><h3>Technologies and Tools</h3><p><strong>Library Information System </strong>which is developed in <a href="https://medium.com/javarevisited/how-to-use-project-lombok-with-spring-boot-ac84bd6047d1">this tutorial</a><strong> </strong>is dockerized in this post. For more details about this project, you can click <a href="https://medium.com/javarevisited/how-to-use-project-lombok-with-spring-boot-ac84bd6047d1">this link</a>.</p><p>The tutorial here uses <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a>, <a href="https://maven.apache.org/">Maven</a>, and <a href="https://medium.com/javarevisited/top-5-free-courses-to-learn-docker-for-beginners-best-of-lot-b2b1ad2b98ad">Docker</a>. I’m running on <a href="https://www.microsoft.com/en-us/windows/">Windows 10</a> using PowerShell.</p><p>All software is written in Java, with Spring 5.2 and Spring Boot 2.2.2, in-memory H2 database is used for persistence.</p><p>From here, I’ll assume you have JDK 13.0, <a href="https://itnext.io/top-5-intellijidea-and-android-studio-courses-for-java-and-android-programmers-afcc27309b60">IntelliJ</a>, <a href="https://medium.com/javarevisited/top-10-free-courses-to-learn-maven-jenkins-and-docker-for-java-developers-51fa7a1e66f6?source=collection_home---4------3-----------------------">Maven</a>, and <a href="https://medium.com/@javinpaul/10-free-courses-to-learn-docker-and-devops-for-frontend-developers-691ac7652cee">Docker </a>installed.</p><p>My goal here is to show how to use Docker in a simple way without shuffling the business logic.</p><p>A Spring Boot application can be dockerized with two most commonly used approaches.</p><ul><li><strong>Dockerfile:</strong> It contains native Docker commands to build the image.</li><li><strong>Maven:</strong> It has a plugin to build the image.</li></ul><h3>Dockerizing using Dockerfile</h3><p>“A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image”. A user can write commands to build an image on Dockerfile.</p><p>Our sample Dockerfile is shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75d7d79add638b1cfc894e7b0188628a/href">https://medium.com/media/75d7d79add638b1cfc894e7b0188628a/href</a></iframe><p>OurDockerfile has four commands. 4️⃣</p><ul><li>FROM command is used for setting a base image. In our Dockerfile , it isopenjdk:13-jdk-alpine .</li><li>ARG command is used for passing a defined variable at build-time to the builder. In this case, it is our .jar file.</li><li>COPY command copies specified file to the image. In this case. our created .jar file will be copied to the base image.</li><li>ENTRYPOINT is used for how to execute the application inside the container.</li></ul><p>After preparing Dockerfile , maven package command should be run to create .jarfile. Because Dockerfile needs this .jar file when running. 💻</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZbXhkxwY8lprk_EZwzkw4g.jpeg" /><figcaption>Build Result</figcaption></figure><p>After all things done, you can run or debug the application using Dockerfile in IntelliJ. I used IntelliJ but if you want, you can do these steps manually. For that, docker build and docker run commands should be used. You can click <a href="https://docs.docker.com/engine/reference/builder/">this link</a> for further information.</p><p>You can see the running image and container of our application. 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*PcS4Q1Uuy6ZxS0Yn7V9Urw.jpeg" /><figcaption>Docker image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4qWHOw0VEfInI4FdhHOWA.jpeg" /><figcaption>Docker container</figcaption></figure><h3>Dockerizing with Maven</h3><p>A Spring Boot application also can be dockerized using Maven. There are a few plugin for dockerizing the application.</p><p>One of them is the <strong>Spotify </strong>plugin. 🎵 For this post, this plugin is used. You can see the configuration of our Maven plugin below. This plugin should be added between &lt;build&gt; &lt;/build&gt; tags.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/979138f62eb8de5966e0dc34129643be/href">https://medium.com/media/979138f62eb8de5966e0dc34129643be/href</a></iframe><p>As you can see, &lt;baseImage&gt; and &lt;entryPoint&gt; tags are used. These tags have the same purpose of Dockerfile’s FROM and ENTRYPOINTcommands respectively.</p><p>After this configuration is done, we can should run the below command to create of an image of our application.</p><pre>mvn clean package docker:build</pre><p>Now, created docker image can be shown with below command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*PcS4Q1Uuy6ZxS0Yn7V9Urw.jpeg" /><figcaption>Docker image</figcaption></figure><p>After that, you should use docker run ... command to run this image.🏃</p><p>Created container for this application looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4qWHOw0VEfInI4FdhHOWA.jpeg" /><figcaption>Docker container</figcaption></figure><h3>Testing with Postman</h3><p>You can easily run this project to testing the <a href="https://medium.com/javarevisited/why-spring-is-the-best-framework-for-developing-rest-apis-in-java-784590e484a4">REST service</a>.</p><p>Of course, you should run the created docker images for testing the REST service. 😃</p><p>If you want to add the book to the Library Information System, you can use the <em>data.json</em> under the project root.</p><p>After running the project, you can test the REST service. For this, open <a href="https://javarevisited.blogspot.com/2020/02/top-5-postman-tutorials-and-courses-for-web-developers.html">Postman</a>, enter the URL, and select the <strong>GET</strong> method like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FI7zg1bG-WLu_bpnYKmERQ.png" /><figcaption>Book list</figcaption></figure><p>Again, enter the link with a book name in the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*382LsWAiuzVvfiJ5syNGzQ.png" /><figcaption>Frankenstein</figcaption></figure><p>You can add a book to the system with <strong>POST</strong> method in Postman. First, you should enter <strong><em>Content-Type : application/json</em></strong> header key-value pair. Second, in body tab, you must enter the book information that you want to save the database in JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2f6ntMc01EekS7gcfRvFA.png" /><figcaption>Adding a book</figcaption></figure><p>If you want to delete a book, you should select <strong>DELETE</strong> method in Postman and add a book name that you want to delete to the end of the link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMMrt3OY3dbGUwhJoz64aw.png" /><figcaption>Deleting a book</figcaption></figure><h3>Resources</h3><ul><li><a href="https://spring.io/">https://spring.io/</a></li><li><a href="https://docs.docker.com/">https://docs.docker.com/</a></li><li><a href="https://medium.com/javarevisited/10-free-spring-boot-tutorials-and-courses-for-java-developers-53dfe084587e">Free Spring Boot Courses for Beginners</a></li><li><a href="https://medium.com/javarevisited/top-5-free-courses-to-learn-docker-for-beginners-best-of-lot-b2b1ad2b98ad">Free Docker Courses for Beginners</a></li></ul><p><strong>Note:</strong> This tutorial focuses on the how-to dockerize a Spring Boot application in a simple way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47842f7142b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/dockerizing-a-spring-boot-application-47842f7142b1">Dockerizing a Spring Boot Application</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Project Lombok with Spring Boot]]></title>
            <link>https://medium.com/@yigitcannalci/how-to-use-project-lombok-with-spring-boot-ac84bd6047d1?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac84bd6047d1</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[h2-database]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[project-lombok]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Wed, 04 Mar 2020 15:09:02 GMT</pubDate>
            <atom:updated>2022-08-13T18:11:14.958Z</atom:updated>
            <content:encoded><![CDATA[<h3>Writing More Readable Code with Project Lombok</h3><p>We have written a lot of boilerplate code such as getter, setter, equals, hashCode methods, etc. in Java for years. In some cases, this causes problems in subjects like clean and readable code.</p><p>For such situations, Project Lombok saves our eyes :). Also, you will be able to spend more time on the business logic using Lombok.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7HktUIk7A3It4bOv" /><figcaption>Photo by <a href="https://unsplash.com/@fachymarin?utm_source=medium&amp;utm_medium=referral">Fachy Marín</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this tutorial, I will tell you about Project Lombok and give an example using Spring Boot.</p><ul><li>Spring Boot and Spring Data projects which are used for developing REST APIs are used here.</li><li><a href="https://maven.apache.org/">Maven</a> is used to automate the build process.</li><li>A typical domain-driven development approach is used, separating model, repository, service, and controller classes.</li></ul><p>You can download the project source code from this <a href="https://github.com/ragcrix/LibraryInformationSystem"><strong>GitHub link</strong></a><strong>.</strong></p><h3>What is Project Lombok?</h3><p>I copied and pasted the description of Project Lombok from <a href="https://projectlombok.org/">here</a> (Official Site). I couldn’t make a better sentence to explain it :). “Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*RNukigFfdkngiEIqyrFdQw.jpeg" /><figcaption>Photo by Kanwar on Slideshare</figcaption></figure><p>“Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.”</p><p>Project Lombok uses annotations to avoid boilerplate code. In the best cases, only five lines can replace hundreds of lines of code.</p><p>As you see below, a few annotations were used instead of almost eighty of lines of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/697d84f9eaf5cd79e3296a011c127774/href">https://medium.com/media/697d84f9eaf5cd79e3296a011c127774/href</a></iframe><p>Descriptions of used annotations according to <em>JavaDoc</em>:</p><ul><li>@Data : “Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check * all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor.”</li><li>@AllArgsConstructor : “Generates an all-args constructor.”</li><li>@NoArgsConstructor : “Generates a no-args constructor.”</li><li>@Slf4j : “Causes Lombok to generate a logger field.”</li></ul><p>You can see the Book model below which is created without using Lombok as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cec697b22146c6898d31b55e61e6614f/href">https://medium.com/media/cec697b22146c6898d31b55e61e6614f/href</a></iframe><p>Project Lombok also provides convenience for logging as follows. For example, you can use the @Slf4j annotation for logging.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b36d01e297921acf72e176b34a8d91e/href">https://medium.com/media/3b36d01e297921acf72e176b34a8d91e/href</a></iframe><h3>How to Install Lombok</h3><p>We can integrate Lombok into our IDE (IntelliJ, Eclipse, etc.) easily.</p><p>In this section, I will tell you about Lombok installation for IntelliJ Idea. You can click <a href="https://projectlombok.org/">here</a> for other installations.</p><ol><li>Firstly, you must select Lombok while initializing your Spring Boot project like below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSzMIkpsdkzHfVhh6qrZug.png" /><figcaption>Project initialization</figcaption></figure><p>2. After that, if you don’t add Lombok plugin to your IDE before, IntelliJ asks you a question. You must select Lombok plugin and click the Ok button to install plugin in your IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*SAzqfiOW2W8dpHrufbzGmg.png" /><figcaption>Installation of Lombok</figcaption></figure><p>You can verify that Lombok is installed in your IDE like below. As soon as the installation of Lombok is done, we are ready to go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*XAVu4FvrsMR0E-OvzBcbSg.png" /><figcaption>Lombok plugin installed</figcaption></figure><h3>Library Information System</h3><p>The tutorial here uses <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a>, <a href="https://gradle.org/">M</a>aven, and <a href="https://www.getpostman.com/apps">Postman</a> for coding, building, and REST API testing. I’m running on <a href="https://www.microsoft.com/en-us/windows/">Windows 10</a> using PowerShell.</p><p>All software is written in Java, with Spring 5.2 and Spring Boot 2.2.2, in-memory H2 database is used for persistence.</p><p>From here, I’ll assume you have JDK 13.0, IntelliJ, <a href="https://gradle.org/">M</a>aven, and Postman installed.</p><p>This library information system brings book information and allows you to add new books to the system or remove books from the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UaftOsJYco1lRQBV" /><figcaption>Photo by <a href="https://unsplash.com/@ivoafr?utm_source=medium&amp;utm_medium=referral">Ivo Rainha</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>My goal here is to show how to use Lombok in a simple way without shuffling the business logic.</p><ul><li>A POST operation is used to add books to the system.</li><li>The <strong>book </strong>table in the in-memory H2 database has the data about each book’s name, writer, genre and year.</li><li>Everything stored, received, and returned by the service is formatted as JSON.</li></ul><p><a href="https://medium.com/javarevisited/top-5-courses-to-learn-microservices-in-java-and-spring-framework-e9fed1ba804d">Top 9 Courses to Learn Microservices in Java and Spring Framework</a></p><h4>Book Model</h4><p>This model has 5 fields: id, name, writer, genre and year.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/697d84f9eaf5cd79e3296a011c127774/href">https://medium.com/media/697d84f9eaf5cd79e3296a011c127774/href</a></iframe><p>These used Lombok annotations are explained above.</p><h4>Book Repository</h4><p>You can easily create an interface extending <em>CrudRepository </em>using Spring Data Project. With this, there is no need to implement this interface :).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91c2b594e73ae2af6932ff03f6e981d4/href">https://medium.com/media/91c2b594e73ae2af6932ff03f6e981d4/href</a></iframe><p>There are four methods in the BookRepository. These are simple <strong>CRUD</strong>(Create, Read, Update, Delete)<strong> </strong>operations.</p><h4>Book Service</h4><p>The book service has four methods. Simply, these methods list books according to some criteria, save or update a book and delete a book.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a381ba93bf01eff156c5d5878ecc51d8/href">https://medium.com/media/a381ba93bf01eff156c5d5878ecc51d8/href</a></iframe><p>You can see the implementation of this interface below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/588a6dbd4e2ac0565e220562206148da/href">https://medium.com/media/588a6dbd4e2ac0565e220562206148da/href</a></iframe><h4>Book Controller</h4><p><em>BookController.java </em>is a REST controller which has two<em> </em>@GetMapping<em>, </em>one @PostMapping and one @DeleteMapping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48f3f8583df273873da1de584110e220/href">https://medium.com/media/48f3f8583df273873da1de584110e220/href</a></iframe><h3>Database Configuration</h3><p>To connect to the H2 database, edit the settings in the <em>“application.properties”</em> file which is part of <em>“resources”</em>. The following configurations are sufficient.</p><pre># Server<br>server.port=9090</pre><pre># Enabling H2 Console<br>spring.h2.console.enabled=true</pre><pre># Datasource<br>spring.datasource.url=jdbc:h2:mem:testdb<br>spring.datasource.driverClassName=org.h2.Driver<br>spring.datasource.username=sa<br>spring.datasource.password=</pre><pre># JPA<br>spring.jpa.show-sql=true<br>spring.jpa.generate-ddl=true<br>spring.jpa.database-platform=org.hibernate.dialect.H2Dialect</pre><p>After running the Library Information System, you can easily access the H2 database with this <a href="http://localhost:9090/h2-console"><strong>link</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*y0j5TZGyX5bmxYF43DsEGg.png" /><figcaption>H2 console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*ufUEbSuDNZ78shuro-j3mg.png" /><figcaption>H2 database</figcaption></figure><p>Note: Whenever this project starts, scripts inside data.sql file which is under the resources directory will run. Of course, oscar goes tooooo Spring Data for this. :)</p><pre>insert into book values(1, &#39;SCI-FI&#39;, &#39;Frankenstein&#39;, &#39;Mary Shelley&#39;, &#39;1818&#39;);<br>insert into book values(2, &#39;Fantastic&#39;, &#39;Harry Potter&#39;, &#39;J. K. Rowling&#39;, &#39;1997&#39;);</pre><p><a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd">10 Advanced Spring Boot Courses for experienced Java Developers in 2024</a></p><h3>Running the Service and Testing with Postman</h3><p>You can easily run this project to test the REST service.</p><p>If you want to add a book to Library Information System, you can use the <em>data.json</em> under the project root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*238R5uU9RJeJXZrtFKstvQ.png" /><figcaption>Run the project in IntelliJ</figcaption></figure><p>After running the project, you can test the REST service. For this, open Postman, enter the URL and select <strong>GET</strong> method like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FI7zg1bG-WLu_bpnYKmERQ.png" /><figcaption>Book list</figcaption></figure><p>Again, enter the link with a book name in the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*382LsWAiuzVvfiJ5syNGzQ.png" /><figcaption>Frankenstein</figcaption></figure><p>You can add a book to the system with <strong>POST</strong> method in Postman. First, you should enter <strong><em>Content-Type : application/json</em></strong> header key-value pair. Second, in body tab, you must enter the book information that you want to save the database in JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2f6ntMc01EekS7gcfRvFA.png" /><figcaption>Adding a book</figcaption></figure><p>If you want to delete a book, you should select <strong>DELETE</strong> method in Postman and add a book name that you want to delete to the end of the link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMMrt3OY3dbGUwhJoz64aw.png" /><figcaption>Deleting a book</figcaption></figure><h3>Resources</h3><ul><li><a href="https://projectlombok.org/">https://projectlombok.org/</a></li><li><a href="https://spring.io/">https://spring.io/</a></li><li><a href="https://www.h2database.com/html/main.html">https://www.h2database.com/html/main.html</a></li></ul><p><strong>Note:</strong> This tutorial focuses on the combination of Spring Data, in-memory H2 and REST API. There is no validation for object fields in the project.</p><h3>Thank you for reading! 🙏 Your thoughts are very valuable to me. Please feel free to share. 😄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac84bd6047d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Brief Information About Docker]]></title>
            <link>https://medium.com/quick-code/a-brief-information-about-docker-3b34446590cd?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b34446590cd</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerizing]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 18:38:10 GMT</pubDate>
            <atom:updated>2020-03-02T18:38:10.897Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are working in a software related area 💻, you may have heard about <strong>Docker</strong> lately. With Docker, you can run Linux and Windows virtual containers (machines) on Linux, Windows and MacOSX. With this platform, you can easily install, test and deploy web systems. Perhaps the most important feature was “It was working on my computer, why didn’t it work on the server?” is eliminating the problem.</p><p>In this post, I will explain Docker in 4 sections.</p><ul><li>What is Docker?</li><li>Main Components of Docker</li><li>Installing Docker</li><li>Docker Commands</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*693Tx7h7G3yE0gYB" /><figcaption>Photo by <a href="https://unsplash.com/@chuttersnap?utm_source=medium&amp;utm_medium=referral">chuttersnap</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Docker?</h3><p><a href="https://www.docker.com/">Docker</a> is an open source virtualization platform developed for software developers and systematics. Docker provides a convenient environment to build, package and run applications, anywhere.</p><p>It’s good to hear that “anywhere”, right? 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NnoyGZYKPxR_URcT" /><figcaption>Photo by <a href="https://unsplash.com/@guibolduc?utm_source=medium&amp;utm_medium=referral">Guillaume Bolduc</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>But, how does Docker do that? 😲</p><ul><li>Of course with containers.</li></ul><p>Docker uses containers for your application, so you don’t need to worry about environment you’re working on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XBDzH8kPBzO5oW492NdLDg.png" /><figcaption>Containers vs Virtual Machines on Docker.com</figcaption></figure><p>Unlike virtualization of servers and a virtual machine, the container does not integrate the Operating System, it communicates directly with the operating system of the server on which it’s deployed.</p><h3>Main Components of Docker</h3><p><em>Docker Engine</em> is a client-server based application and has a few main components. These components are listed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*MCpIQ-o9mMaMij4TPjKvcg.jpeg" /><figcaption>Docker Engine on Docker.com</figcaption></figure><ul><li>The<strong> Server</strong> is a daemon process (Docker Daemon, the dockerd command) which is responsible for creating and managing Docker Images, Containers, Networks and Volumes.</li><li>The <strong>REST API</strong> provides the communication between applications and the Server and instruct it to get their job done.</li><li>The <strong>Client </strong>is a command line interface (CLI), which allows users to interact with Docker using the commands.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*eaN19W8gv7D0kUlgNTY4vg.png" /><figcaption>Docker Architecture on Docker.com</figcaption></figure><p>I found an explanation about Docker architecture on <em>Docker.com</em>. I copied and pasted below directly, because it is such a good explanation. You can read this explanation below and you can also click for further information about it.</p><p>“<a href="https://docs.docker.com/engine/docker-overview/">Docker uses a client-server architecture. The Docker <em>client</em> talks to the Docker <em>daemon</em>, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon <em>can</em> run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.</a>”</p><h3>Installing Docker</h3><p>Before we get started to use Docker, we must install it on our machine. 😎 For this, you can click the links below related to your OS.</p><ul><li><a href="https://docs.docker.com/docker-for-mac/install/">For MacOS</a></li><li><a href="https://docs.docker.com/docker-for-windows/install/">For Windows</a></li><li><a href="https://docs.docker.com/install/linux/docker-ce/centos/">For Centos</a></li><li><a href="https://docs.docker.com/install/linux/docker-ce/debian/">For Debian</a></li><li><a href="https://docs.docker.com/install/linux/docker-ce/fedora/">For Fedora</a></li><li><a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">For Ubuntu</a></li></ul><p>After the installation is done, you can do everything you want using Docker. <strong>SHOW NO MERCY</strong> 😡.</p><h3>Docker Commands</h3><p>In this stage, I will describe base commands of Docker shortly 🐑. I don’t give any snapshots of these commands. You can find detailed descriptions of these commands on many sites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ycZEyIqwFsrZRYIq" /><figcaption>Photo by <a href="https://unsplash.com/@mael_bld?utm_source=medium&amp;utm_medium=referral">Mael BALLAND</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ul><li>docker create : We can create a new container.</li><li>docker ps : This command allows us to list all running containers on the Docker Host.</li><li>docker start : We can start any stopped container.</li><li>docker stop : We can stop any started container with the first few unique characters like docker start command.</li><li>docker run : This command is combination of docker create and docker start commands. It creates a container and then it starts the container.</li><li>docker rm : If we want to delete a container, we can use it.</li><li>docker images : This commands lists all images which present on the Docker Host.</li><li>docker rmi : We can delete an image with this command.</li></ul><p>You can click this <a href="https://docs.docker.com/engine/reference/commandline/docker/">link</a> for further information about Docker commands.</p><h3><strong>Conclusion</strong></h3><p>If you want to run your applications anywhere without considering environment you are working on, you should give Docker a chance.</p><p>This article contains brief information about Docker that every developer should know. Then, I will explain how to dockerize a Spring Boot application. 😃</p><h3>Resources</h3><ul><li><a href="https://docs.docker.com/engine/docker-overview/">https://docs.docker.com/engine/docker-overview/</a></li></ul><h3>Thank you for reading! 🙏 Your thoughts are very valuable to me. Please feel free to share. 😄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b34446590cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quick-code/a-brief-information-about-docker-3b34446590cd">A Brief Information About Docker</a> was originally published in <a href="https://medium.com/quick-code">Quick Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Application as a Windows Service]]></title>
            <link>https://medium.com/javarevisited/spring-boot-application-as-a-windows-service-4c775556518e?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c775556518e</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[windows-services]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Wed, 01 Jan 2020 15:13:15 GMT</pubDate>
            <atom:updated>2020-03-02T14:08:28.303Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I will share with you how to run the Spring Boot application as a Windows Service.</p><p>These situations are very rare for Spring Boot applications but you can face like these. To accomplish this, you should read carefully what I wrote ;).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ivTyXqjqxyOLuCkw" /><figcaption>Photo by <a href="https://unsplash.com/@casparrubin?utm_source=medium&amp;utm_medium=referral">Caspar Camille Rubin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For running your application as a Windows service, you should do a few steps.</p><h3>Maven Configuration</h3><p>You can package your application as JAR or WAR. This is configured by <strong><em>pom.xml</em></strong> file like below. For this subject, we continue with JAR packaging.</p><pre>&lt;packaging&gt;jar&lt;/packaging&gt;</pre><p>After that you should add <strong><em>spring-boot-maven-plugin</em> </strong>artifact to your <strong><em>pom.xml</em></strong>.</p><pre>&lt;build&gt;<br>    &lt;plugins&gt;<br>        &lt;plugin&gt;<br>            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>            &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;<br>            &lt;configuration&gt;<br>                &lt;executable&gt;true&lt;/executable&gt;<br>            &lt;/configuration&gt;<br>        &lt;/plugin&gt;<br>    &lt;/plugins&gt;<br>&lt;/build&gt;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7082e04c7c984de2d0fa8e8326cfff7e/href">https://medium.com/media/7082e04c7c984de2d0fa8e8326cfff7e/href</a></iframe><p>As you see above, &lt;executable&gt; parameter is true. <strong><em>MANIFEST.MF</em></strong> file is added to the JAR package with this parameter. This manifest contains a <em>Main-Class</em> entry that specifies which class defines the main method for your application. If you don’t know Maven and want to learn about it, you can also check out these <a href="https://dev.to/javinpaul/10-free-devops-courses-to-learn-jenkins-docker-and-maven-for-programmers-ohp">Maven courses</a></p><p><a href="https://javarevisited.blogspot.com/2019/03/top-5-course-to-learn-apache-maven-for.html">Top 5 Courses to Learn Maven Online in 2022 - Best of Lot</a></p><p>After these configurations are done, you should write below command to package your application as JAR.</p><pre>$ mvn clean package</pre><p>Now, you can test your application’s JAR package with the command below.</p><pre>$ java -jar yourApp.jar</pre><h3>Windows Service Wrapper(WinSW)</h3><p>For running a Java application as a Windows service, we need a tool called Windows Service Wrapper(WinSW). You can download this tool from this <a href="https://github.com/kohsuke/winsw/releases/tag/winsw-v2.1.2">link</a>. Also <strong>.Net Framework 4</strong> must be installed in your machine for WinSW.</p><p>After downloading WinSW, you must follow the steps below.</p><ul><li>Put the JAR file, WinSW executable and config in the same folder.</li><li>WinSW-xxx.xml file need to be configured correctly like below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*h-Ap_vsTZk0HPNhuBg8DEg.png" /><figcaption>Directory of WinSW</figcaption></figure><ul><li>The last two tags can remain the same. For our purpose, we just want to execute java -jar ./XXX.jar.</li></ul><pre>&lt;configuration&gt;<br>&lt;!-- ID of the service. It should be unique accross the Windows system--&gt;<br>&lt;id&gt;RC-XXX-SERVICE&lt;/id&gt;<br>&lt;!-- Display name of the service --&gt;<br>&lt;name&gt;My Spring Boot App&lt;/name&gt;<br>&lt;!-- Service description --&gt;<br>&lt;description&gt;Spring Boot Service&lt;/description&gt;<br><br>&lt;!-- we need to execute java -jar ./XXX.jar --&gt;<br>&lt;executable&gt;java&lt;/executable&gt;<br>&lt;arguments&gt;-jar &quot;%BASE%\YOUR-APP.jar&lt;/arguments&gt;<br>&lt;/configuration&gt;</pre><h3>Install the Spring Boot Application as a Windows Service</h3><ul><li>After the configuration of XML file, you must open Windows CLI as administrator. You run the following two commands in succession.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*a_HuBBFBGqlQu76o7X1XXA.png" /><figcaption>Application installed as a Windows Service</figcaption></figure><pre>$ winsw-2.2.0-net4.exe install<br>$ net start RC-XXX-SERVICE</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1-BKqA1QPvi-DFdTyj6NA.png" /><figcaption>Spring Boot app as a Windows Service</figcaption></figure><ul><li>We install the application with first command. Second command starts the application. Also, you can start the application from Windows Services.</li></ul><h3>Thank you for reading! 🙏 Your thoughts are very valuable to me. Please feel free to share. 😄</h3><p>Other <strong>Java and Spring articles</strong> you may like</p><ul><li>5 Spring Boot Features Every Java Developer Should Know (<a href="https://javarevisited.blogspot.com/2018/11/top-5-spring-boot-features-java.html#axzz5YFjHrt5j">features</a>)</li><li>Top 5 Free Courses to learn Spring and Spring Boot (<a href="http://www.java67.com/2017/11/top-5-free-core-spring-mvc-courses-learn-online.html">courses</a>)</li><li>5 Course to Master Spring Boot online (<a href="https://javarevisited.blogspot.com/2018/05/top-5-courses-to-learn-spring-boot-in.html">courses</a>)</li><li>10 Things Java Developer should learn (<a href="https://javarevisited.blogspot.com/2017/12/10-things-java-programmers-should-learn.html#axzz5atl0BngO">goals</a>)</li><li>10 Tools Java Developers use in their day-to-day life (<a href="http://javarevisited.blogspot.sg/2017/03/10-tools-used-by-java-programming-Developers.html#axzz55lrMRnNC">tools</a>)</li><li>10 Tips to become a better Java developer (<a href="https://javarevisited.blogspot.com/2018/05/10-tips-to-become-better-java-developer.html">tips</a>)</li><li>Top 5 Courses to learn Microservices in Java? (<a href="https://medium.com/javarevisited/top-5-courses-to-learn-microservices-in-java-and-spring-framework-e9fed1ba804d">courses</a>)</li><li>3 Best Practices Java Programmers can learn from Spring (<a href="https://javarevisited.blogspot.com/2018/06/3-best-practices-java-programmers-can-learn-from-spring-framework.html#axzz5K0PIOpHD">best practices</a>)</li><li>5 courses to learn Spring Boot and Spring Cloud ( <a href="https://javarevisited.blogspot.com/2018/07/top-5-books-to-learn-spring-boot-and-spring-cloud-java.html">courses</a>)</li><li>3 ways to change Tomcat port in Spring Boot (<a href="https://www.java67.com/2019/07/spring-boot-3-ways-to-change-port-of-tomcat.html">tutorial</a>)</li><li>10 Advanced Spring Boot Courses for Java Programmers (<a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd">courses</a>)</li><li>10 Spring MVC annotations Java developers should learn (<a href="https://www.java67.com/2019/04/top-10-spring-mvc-and-rest-annotations-examples-java.html">annotations</a>)</li><li>15 Spring Boot Interview Questions for Java Programmers (<a href="https://www.java67.com/2018/06/top-15-spring-boot-interview-questions-answers-java-jee-programmers.html">questions</a>)</li></ul><p>Thanks for reading this article so far. If you find this article useful then please share it with your friends and colleagues. If you have any questions or feedback then please drop a note.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c775556518e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/spring-boot-application-as-a-windows-service-4c775556518e">Spring Boot Application as a Windows Service</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is new in Java 13]]></title>
            <link>https://medium.com/javarevisited/what-is-new-in-java-13-d3d7ae7fc741?source=rss-bf5808bbc9ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3d7ae7fc741</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java-13]]></category>
            <dc:creator><![CDATA[Yiğitcan Nalcı]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 15:02:29 GMT</pubDate>
            <atom:updated>2020-02-28T14:01:45.524Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is New in Java 13</h3><p>Greetings after a long break. In this post, I will tell you Text Blocks(JEP 355) and Switch Expressions(JEP 354) in Java 13.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*G1vYbqb1KCmxkNk_UEZNFQ.png" /><figcaption>Java 13</figcaption></figure><p>As you see, some other features in Java 13 are listed below. You can click this <a href="https://www.oracle.com/technetwork/java/13-relnote-issues-5460548.html#NewFeature">link </a>for more information about these features.</p><ul><li>Reimplement the Legacy Socket API — JEP 353</li><li>Dynamic CDS Archive — JEP 350</li><li>ZGC: Uncommit Unused Memory — JEP 351</li><li>FileSystems.newFileSystem() Method</li><li>Support for Unicode 12.1</li><li>DOM and SAX Factories with Namespace Support?</li></ul><h3>How to enable support for Java 13 preview features?</h3><p>Text Blocks(JEP 355) and Switch Expressions(JEP 354) are preview features for Java 13. You can use these features by enabling the preview-feature settings in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7np62-S7yWwsdP7R" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you are running java program from the command line, you can enable it using the --enable-preview switch. You can use this switch to start JShell with preview features enabled.</p><pre>$ jshell --enable-preview  <br>$ java --enable-preview --source 13 Test.java</pre><p>If you are using IntelliJ IDEA, you have to set the corresponding Language Level in the Project Structure settings and install the JDK to compile.</p><p>If you are using Eclipse, you can enable the preview features from the Java Compiler settings.</p><h3>Text Blocks</h3><p>Multiline strings can be created easily with this preview feature. The multiline string has to be written inside a pair of triple-double quotes.</p><p>You can create these text blocks using just these quotes without the need for anything else.</p><pre>public class TextBlocks {<br><br>    <em>/**<br>     * JEP 355: Preview Feature<br>     */<br>    </em>@SuppressWarnings(&quot;preview&quot;)<br>    public static void main(String[] args) {<br>        String textBlock = &quot;&quot;&quot;<br>            Hello<br>            Java13<br>            New Feature&quot;&quot;&quot;;<br><br>        String str = &quot;Hello\nJava13\nNew Feature&quot;;<br><br>        System.<em>out</em>.println(&quot;Text Block String:\n&quot; + textBlock);<br>        System.<em>out</em>.println(&quot;Normal String:\n&quot; + str);<br><br>        System.<em>out</em>.println(&quot;Text Block and String Literal equals() Comparison: &quot; + (textBlock.equals(str)));<br>        System.<em>out</em>.println(&quot;Text Block and String Literal == Comparison: &quot; + (textBlock == str));<br>    }<br><br>}</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoP3wgsca_UP-MYUxxrq1Q.png" /><figcaption>Text blocks output</figcaption></figure><p>Using text blocks in Java 13, also you can use new methods in String class. For example, formatted(Object... args), stripIndent(), translateEscapes().</p><h3>Switch Expressions</h3><p>With Java 12 release, switch expressions were added as a preview feature. I have already mentioned <a href="https://medium.com/@yigitcannalci/how-to-use-new-switch-expressions-in-java-12-8510ab9f83c3?source=friends_link&amp;sk=da9966b5f3af9fc37cafea0f0b762574">here</a> how to use them in Java 12.</p><p>Java 12 release is almost same in Java 13 except yield . With Java 13, the break statement has been replaced with yield .</p><pre>public class SwitchExpressions {<br><br>    @SuppressWarnings(&quot;preview&quot;)<br>    public static void main(String[] args) {<br>        Day day = Day.<em>WEDNESDAY</em>;<br><br>        switch (day) {<br>            case <em>MONDAY</em>:<br>            case <em>FRIDAY</em>:<br>            case <em>SUNDAY</em>:<br>                System.<em>out</em>.println(6);<br>                break;<br>            case <em>TUESDAY</em>:<br>                System.<em>out</em>.println(7);<br>                break;<br>            case <em>THURSDAY</em>:<br>            case <em>SATURDAY</em>:<br>                System.<em>out</em>.println(8);<br>                break;<br>            case <em>WEDNESDAY</em>:<br>                System.<em>out</em>.println(9);<br>                break;<br>            default:<br>                System.<em>out</em>.println(-1);<br>        }<br><br>        // from java 13 onwards - multi-label case statements<br>        switch (day) {<br>            case <em>MONDAY</em>, <em>FRIDAY</em>, <em>SUNDAY</em>:<br>                System.<em>out</em>.println(6);<br>                break;<br>            case <em>TUESDAY</em>:<br>                System.<em>out</em>.println(7);<br>                break;<br>            case <em>THURSDAY</em>, <em>SATURDAY</em>:<br>                System.<em>out</em>.println(8);<br>                break;<br>            case <em>WEDNESDAY</em>:<br>                System.<em>out</em>.println(9);<br>                break;<br>            default:<br>                System.<em>out</em>.println(-1);<br>        }<br><br>        // switch expressions, use yield to return, in Java 12 it was break<br>        int x = switch (day) {<br>            case <em>MONDAY</em>, <em>FRIDAY</em>, <em>SUNDAY</em>:<br>                yield 6;<br>            case <em>TUESDAY</em>:<br>                yield 7;<br>            case <em>THURSDAY</em>, <em>SATURDAY</em>:<br>                yield 8;<br>            case <em>WEDNESDAY</em>:<br>                yield 9;<br>            default:<br>                yield -1;<br>        };<br>        System.<em>out</em>.println(&quot;x = &quot; + x);<br><br>    }<br><br>    enum Day {<br>        <em>MONDAY</em>, <em>TUESDAY</em>, <em>WEDNESDAY</em>, <em>THURSDAY</em>, <em>FRIDAY</em>, <em>SATURDAY</em>, <em>SUNDAY</em>;<br>    }</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I445HsQvV5BA1YZ5fi7wIw.png" /><figcaption>Switch expressions output</figcaption></figure><p><strong>Note:</strong> You can download the source code from Github with this <a href="https://github.com/ragcrix/Java13Features">link</a>.</p><p>Other <strong>Useful Resources for learning Java </strong>you may like<br><a href="https://javarevisited.blogspot.com/2017/12/10-things-java-programmers-should-learn.html#axzz5atl0BngO">10 Things Java Programmer Should Learn in 2020</a><br><a href="http://www.java67.com/2018/08/top-10-free-java-courses-for-beginners-experienced-developers.html">10 Free Courses to Learn Java from Scratch</a><br><a href="https://medium.freecodecamp.org/must-read-books-to-learn-java-programming-327a3768ea2f">10 Books to Learn Java in Depth</a><br><a href="http://www.java67.com/2018/04/10-tools-java-developers-should-learn.html">10 Tools Every Java Developer Should Know</a><br><a href="http://javarevisited.blogspot.sg/2013/04/10-reasons-to-learn-java-programming.html">10 Reasons to Learn Java Programming languages</a><br><a href="http://javarevisited.blogspot.sg/2018/01/10-frameworks-java-and-web-developers-should-learn.html">10 Frameworks Java and Web Developer should learn in 2020</a><br><a href="http://javarevisited.blogspot.sg/2018/05/10-tips-to-become-better-java-developer.html">10 Tips to become a better Java Developer in 2020</a><br><a href="http://javarevisited.blogspot.sg/2018/04/top-5-java-frameworks-to-learn-in-2018_27.html">Top 5 Java Frameworks to Learn in 2020</a><br><a href="https://javarevisited.blogspot.sg/2018/01/10-unit-testing-and-integration-tools-for-java-programmers.html">10 Testing Libraries Every Java Developer Should Know</a></p><p><a href="https://javarevisited.blogspot.com/2019/10/the-java-developer-roadmap.html#123">The 2020 Java Developer RoadMap</a></p><h3>Thank you for reading! 🙏 Your thoughts are very valuable to me. Please feel free to share. 😄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3d7ae7fc741" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/what-is-new-in-java-13-d3d7ae7fc741">What is new in Java 13</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>