<?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 Andhika Yusup on Medium]]></title>
        <description><![CDATA[Stories by Andhika Yusup on Medium]]></description>
        <link>https://medium.com/@andhikayusup?source=rss-26c8068337ee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZUFnn3oCrdjSNQBDj_j8eQ.jpeg</url>
            <title>Stories by Andhika Yusup on Medium</title>
            <link>https://medium.com/@andhikayusup?source=rss-26c8068337ee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 08:28:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andhikayusup/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[Study Case of QRIS: System That Glues Indonesian E-wallet]]></title>
            <link>https://medium.com/@andhikayusup/study-case-of-qris-system-that-glues-indonesian-e-wallet-830aac50d957?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/830aac50d957</guid>
            <category><![CDATA[payment-systems]]></category>
            <category><![CDATA[qris]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 00:43:19 GMT</pubDate>
            <atom:updated>2022-08-11T00:43:19.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVuxPpCL3vRqiqqXJa4gKA.png" /></figure><p>Let’s say you are a Gopay user (one of the e-wallets in Indonesia) and want to buy something from a small merchant. The merchants must also have the same e-wallet since transferring funds between different e-wallets is impossible. But what if they don’t? What if the merchants only have one e-wallet and that one wallet is not the same as yours? Even though the merchant has covered all the e-wallets, managing all of those will be a hassle.</p><p>According to its <a href="http://qris.id/">official website</a>, QRIS (Indonesian Quick Response Code Standard) is a National QR code standard to facilitate QR code payments in Indonesia. This standard was launched by Bank Indonesia and the Indonesian Payment System Association (ASPI) on August 17, 2019.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6sN6CwSEVs5-hn-X-vQwQ.jpeg" /><figcaption>QRIS Impact Illustration by qris.id</figcaption></figure><p>QRIS is a solution that solves cross-cutting concerns between customers, merchants, and e-wallet providers.</p><ul><li><strong>As a customer</strong>, we want to stick to a few e-wallets and be able to pay for services with the e-wallets that we have.</li><li><strong>As a merchant</strong>, we want to cover all payment methods so that customers won’t flee to competitors just because they cannot pay.</li><li><strong>As an e-wallet provider</strong>, we want to retain users (customers and merchants) from big competitors with a large user base. Users will flee if they cannot use the e-wallets since only a few merchants provide the same e-wallet.</li></ul><p>QRIS provide policy and infrastructure to integrate between e-wallet provider. We no longer need several e-wallets to cover as much as possible. With a single QR code, a customer can pay without having a said constraint.</p><blockquote>“Build The Right Thing and Build The Thing Right “<br> — <strong>Steve Smith</strong>.</blockquote><p><strong>QRIS is a case of a solution that fits a problem</strong> in contrast to a problem that fits the solution. Payment with a QR code is not a fancy approach at the moment. But with the right issue, this method is a humble approach just enough to solve a problem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=830aac50d957" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka on The Microservice Architecture]]></title>
            <link>https://medium.com/@andhikayusup/kafka-on-the-microservice-architecture-dc52d73837f2?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc52d73837f2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Sun, 26 Sep 2021 06:59:02 GMT</pubDate>
            <atom:updated>2021-09-30T14:35:26.738Z</atom:updated>
            <content:encoded><![CDATA[<h4>Kafka Introduction and Its Role In the Microservice World</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*TrdjDlxNpb4z9Nwe93uARg.png" /><figcaption>Apache Kafka Header</figcaption></figure><p>The rise of Microservice Architecture may help companies build highly scalable products; while at the same time, opening up new points of failure we never had before. The Microservice architectural model dictates that a system should be divided into small but independent services. You might have tens or hundreds of services to maintain instead of a big chunk of monolith application.</p><p>Although each service is disconnected, you might still need integration in the form of data passing between each service. Let say you have ten services, then you might end up with up to 45 integrations. Now, imagine having to integrate 100 services; it is a nightmare, isn’t it? Not to mention the different requirement for each service such as different types of connections, types of data format, and so on and so forth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*RqBs4aEzhTq6KC3VqSZBSg.png" /><figcaption>Service Integration Without Kafka</figcaption></figure><p>Kafka provides a solution for this particular problem where this tech product decouples each service with the Message Queue model. Kafka is a message broker between services, meaning the service sends data to Kafka without actually know which service is the recipient, vice versa. A producer, a service that sends messages, could just send Kafka’s data and assume the message was received. This pattern is basically a publish-subscribe messaging pattern which you can read more <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">about here</a>.</p><p>With this flow, a service now does not need to wait for a response from the recipient. This led Kafka to enable services to process data in real-time. Kafka also allows a system to be better in scalability rather than traditional service integrations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*X3mVsUby5eWj2HGc0tF8oQ.png" /><figcaption>Service Integration With Kafka</figcaption></figure><p>This article will introduce you to Kafka components to provide you a basic understanding of what Kafka is so that you can see how simple the system is and help you into the rabbit hole of learning this fantastic tech product.</p><h3>Kafka Topics, Partition, and Offset</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*cdSCuWUoqFiasJNu7OSNrQ.png" /><figcaption>Relationship between Kafka Topics, Partitions, and offsets</figcaption></figure><p>One of the main components, when we are talking about Kafka, is Kafka Topics. <strong>This component labels specific message streams into a group based on the topic this data addresses, hence Kafka Topics</strong>. You can have as many Kafka Topics you want but make sure its label is unique.</p><p><strong>In Kafka Topics, data will be split into several partitions.</strong> This partition will be in an ordered manner, and each partition is identified by its number. You need to specify how many partitions you need when creating a partition. Otherwise, It will adhere to the default configuration. But, don’t worry, you can change the partition number later.</p><p><strong>Each message stored within a partition has incremental identifiers, called offset.</strong> A partition is independent, and an offset between the partition does not contain the same data. A message arrived into a partition guaranteed to be written sequentially (but not across a partition, it also does not always include the same number of offsets). Each message stored in Kafka is immutable, meaning you cannot change already stored data.</p><h3>Kafka Broker, Producer, and Consumer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*Q5zNbNthxwmgI8oy_wlmMQ.png" /><figcaption>Relationship Between Kafka Cluster, Brokers, and Partitions</figcaption></figure><p>Kafka Broker is a server containing only some Kafka Topic partitions. Kafka will assign and spread a partition into a random broker. Kafka maintains this distribution, so you don’t have to implement this action. But, how do you access all the information in Kafka if it is distributed? In Kafka, <strong>every broker is a bootstrap server, meaning if you had access to one broker, you had access to the whole cluster of Kafka Broker</strong>.</p><p><strong>Kafka implements the concept of data replication.</strong> Each partition has a backup somewhere in a different random broker so that in case of failure, the system still working. The number of backups it has is specified by the replication factor the user set when creating topics.</p><p><strong>Each partition will have one leader at one time and many In-Sync Replicas (ISR)</strong>. The leader is responsible for receiving and serving data; meanwhile, the ISR is just syncing the data. If a broker that contains a partition leader goes down, then one of the ISR will be the leader until that failed broker is running again.</p><p>A service called Zookeeper assigns the leader of a partition in the background, including the case of reassigning leader when a broker failure. Zookeeper is basically a broker management service to facilitate Kafka handle changes such as new topics, partition updates, and others. <strong>Importantly, to be able to run a Kafka service requires a running Zookeeper service.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*ugZBhVZnbB-IrT7eQ6bOLQ.png" /><figcaption>Relationship Between Kafka Producer, Consumer, and Brokers</figcaption></figure><p><strong>A service that produces and sends information into Kafka Topics is called Producer.</strong> A producer does not need to acknowledge which broker they need to send it to; it is only need to include a message key and that message will always goes to the same partition. If producer sent messages without a key, then those messages will be sent round robin between broker. You can read more about round robin approach in the link <a href="https://dattell.com/data-architecture-blog/load-balancing-with-kafka/">here</a>.</p><p><strong>A producer can choose a message acknowledgment methods that is sent to Kafka</strong>. There are three cases of acknowledgment methods that can be selected by setting the acks. First, the Producer doesn’t want to know the acknowledgment (acks = 0). Second, Producer only gets the acknowledgment from the partition leader (acks = 1). Last, the Producer receives the acknowledgment from the partition leader and its ISR (acks = all).</p><p><strong>A service that consumes (and subscribes) messages from topics is called Consumer.</strong> A Consumer just tell what topics they need to access without specifiying which broker to read from. It can read from multiple partitions and many topics as needed. The reading mechanism of a Consumer is simple; It read offsets sequencially within partition (But, it does not guarantee the reading order across partition). Whenever it read an offset, Kafka will save the last offset a consumer read. So, in case of consumer failure, the consumer will able to read from the last offset once it running again.</p><h3>Hands-on</h3><p>This hands-on will guide you to the “Hello, World!” of Kafka. We will run Zookeeper and Kafka service to send simple messages from our CLI.</p><h4>Prerequisite</h4><ul><li>Kafka</li><li>JDK 1.8</li></ul><h4>Guide</h4><p>First, make sure to install JDK 1.8 and Kafka first. You can check the requirements is installed by typing this simple command: java -version and kafka-topics.sh --version (it might be different from your machine).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otR7HdfDziJHDU26_FPVog.png" /></figure><p>Then, run the Zookeeper service by using the command zookeeper-server-start.sh &lt;zookeeper properties&gt;. First, You need to specify the configuration for the zookeeper. There is a default template file already that you can use in the installation folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXmYPrqXz9VKHtrH_ypKbw.png" /></figure><p>Then, Open a new terminal, and run the Kafka service by using the command kafka-server-start.sh &lt;kafka server properties&gt;. Also, You need to specify the configuration for Kafka. You can use the default configuration found in the installation folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qH7rU6OmgwhAtIqc456pyQ.png" /></figure><p>Then, open a new terminal, and create new Topics by executing this command kafka-topics.sh --zookeeper &lt;zookeeper url&gt;:&lt;zookeeper port&gt; --topic &lt;topic name&gt; --create --partitions &lt;desired partition number&gt; --replication-factor &lt;desired partition number&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YcCvgJ_YOZBvyG-O0x1CxQ.png" /></figure><p>Next, get into Producer CLI by running this program kafka-console-producer.sh --broker-list &lt;kafka url&gt;:&lt;kafka port&gt; --topic &lt;name of topic&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKsfNvDD_RG3MdrkZl09fA.png" /></figure><p>Last, Open another terminal, then run this command to open Consumer CLI kafka-console-consumer.sh --bootstrap-server &lt;kafka url&gt;:&lt;kafka port&gt; --topic &lt;name of topic&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u5Hm12gFuZRJfMzplvLh9A.png" /></figure><h4>Result</h4><p>We have been successfully run the Kafka service. Even though we only run Consumer and Producer from CLI, I think it is a significant baby step for you to explore more about Kafka in the future. The gif below is the result of the message passing process from Producer to Consumer. Congratulations!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*jGdVQACHV9NWQ2niUXXN0A.gif" /></figure><h3><strong>Acknowledgement</strong></h3><p>You can learn in-depth about Kafka by watching this fantastic course from Stephane Maarek. I know a lot from this course, and I think you should too. You can access his teaching by the link below.</p><p><a href="https://www.linkedin.com/learning/learn-apache-kafka-for-beginners/">Learn Apache Kafka for Beginners Online Class | LinkedIn Learning, formerly Lynda.com</a></p><p>This article is the embodiment of my learning progress in Kampus Merdeka x Gojek internship program. Feel free to follow me to receive updates on my learning journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc52d73837f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Guide for Beginner: Entity Relationship]]></title>
            <link>https://medium.com/@andhikayusup/spring-boot-guide-for-beginner-entity-relationship-65fd614f07c6?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/65fd614f07c6</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Thu, 16 Sep 2021 01:51:18 GMT</pubDate>
            <atom:updated>2021-09-16T01:51:18.567Z</atom:updated>
            <content:encoded><![CDATA[<h4>Translate ERD into real database model implementation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*T47QgoOIL4aZ4lrHYdmqHw.png" /><figcaption>Header Image</figcaption></figure><p>Spring Framework made developers build services easily with the support of a wide range of module choices. One of the common module integration in Spring is Spring Data JPA. This library helps you to generate model entities and its relationship without taking much effort. Not to mention its combination with Hibernate as an ORM library will help you to perform the basic function to select, create, filter, and many other capabilities from the database.</p><p>This article will guide you through constructing the given Entity Relationship Diagram into a real Database Schema Model, emphasizing how to map the relation between model entities. There is so much to learn in Spring Boot, and I advise you to learn one thing at a time.</p><h3>Prerequisites</h3><p>This article will not cover how to start a spring boot server. Make sure you have a running application with these dependencies:</p><ul><li>Spring Web</li><li>Spring Data JPA</li><li>Any database driver (such as PostgreSQL, H2, or DB2, depending what your preferred DB)</li></ul><p>Once all requirements are met, go to your main application folder and create a new package/folder with the name “model.” This folder is where the model entities are stored. It is important to organize your code so that it is maintainable. You can read more about Spring Boot project structure best-practice in this amazing article below.</p><p><a href="https://kurular4.medium.com/spring-boot-project-structure-b66d457691f">Spring Boot - Project Structure Practices</a></p><h3>Coding Hands-On</h3><p>We were given this Entity Relationship Diagram (ERD) below to implement the Spring Data JPA model. This ERD describes a system where we have two kinds of Users: Customers and Couriers. Customers order Services (which are performed by Courier) and record that activity in the Transaction model.</p><figure><img alt="Problem Model ERD" src="https://cdn-images-1.medium.com/max/1024/1*WeJrS0RbizKm6UtTqsdcKQ.png" /><figcaption>Problem Model ERD</figcaption></figure><p>We have five hypothetical models to be implemented, but we might have more than that in the end. There are three kinds of relationships that we can cover such as, One-to-One, Many-to-One, and Many-to-Many. Since this guide emphasizes implementing entity relationships in Spring Data JPA, we will break down each model depending on the relationship between models.</p><h3>Basic Entity Model</h3><p>You can effortlessly implement an entity into a schema/table in your database with simple changes to the model class. Sample code for a sample entity below demonstrates how easy it is to do so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w650sePgH2q-2CnfF6sTmw.png" /><figcaption>Sample Entity Database Implementation</figcaption></figure><p>We used only a few annotations that automatically generate a table in the database without manually create one. The detailed explanation of these annotations are as the following:</p><ul><li>@Entity annotation defines that said class is an entity and will be mapped to a database table</li><li>@Table annotation defines the name of the database table to be used for mapping.</li><li>@Id annotation defines the primary key of an entity</li></ul><h3>One-to-One Relationship</h3><p>A one-to-one relationship is when you have two entities, A and B, and element A may only be linked to one element B, vise versa. We have the UserBase model in this problem, which inherits two model classes: Customer and Courier. The relationship between these classes is a One-to-One relationship. It means that we can only connect one Customer instance to one UserBase instance, vice versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoBVHloVxTVx1pRrHBwh_g.png" /><figcaption>One-to-One Relationship Implementation in UserBase.java</figcaption></figure><p>First, we need to implement the superclass, which is the UserBase class. We create the required attributes with its specified types according to the ERD, such as id, email, fullName, and dob.</p><p>With @Inheritance annotation, we could specify which strategy we used to map entities between superclass and subclass. Since we need to map all entities in the hierarchy, we use InheritanceType.JOINED as our strategy. You can review other strategies in this article <a href="https://www.baeldung.com/jpa-one-to-one">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pirkeCs1pvgBvGD8DWlYwQ.png" /><figcaption>One-to-One Relationship Implementation in Customer.java</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sihBKOl7qhlFz5e6_S_f3g.png" /><figcaption>One-to-One Relationship Implementation in Courier.java</figcaption></figure><p>Extend the superclass, and we can map all the subclass without providing additional annotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*GSWsFKX7UJw4lzoCbdjrpg.png" /><figcaption>Database Model Implementation 1</figcaption></figure><p>As the screenshot above shows, we have successfully implemented three tables from our Entity Class because we are using InheritanceType.JOINED as our strategy. The id from Courier and Customer table is a Primary Key and, at the same time, is a Foreign Key from the UserBase table.</p><h3>One-to-Many Relationship</h3><p>A one-to-many relationship is when you have two entities, A and B, and element A may link to many elements of B, but not the contrary. The ERD required us to implement the Transaction entity with one Customer while a Customer may have many Transaction instances. In addition, this condition is also applied to Courier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTGQ7NQGeKufJdbImPM6YA.png" /><figcaption>Many-to-One Relationship Implementation in Transaction.java</figcaption></figure><p>We have not created a Transaction class, so we need to create one first. Since we wanted the Transaction entity to have a many-to-one relationship with the Customer and Courier entity, we need to create an instance of the targeted class as Transaction properties with @ManyToOne annotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KL8aX7JyAkUSg2m1OmlP_g.png" /><figcaption>Many-to-One Relationship Implementation in Customer.java</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JY9Z17N9EFZH3waMU0OZ8Q.png" /><figcaption>Many-to-One Relationship Implementation in Courier.java</figcaption></figure><p>Then, add List of Transaction into Customer entity and Courier entity because a Customer/Courier may have more than one Transaction entities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*YADg6v9ZqUZrXzM-lVGNOA.png" /><figcaption>Database Model Implementation 2</figcaption></figure><p>As the screenshot above shows, we have successfully implemented Transaction tables for our database. Notice that we have additional tables which Spring Data JPA autogenerates. It is expected behavior because these tables will hold all User’s Transactions (which may exist more than one per user).</p><h3>Many-to-Many Relationship: Part 1</h3><p>A many-to-many relationship is when you have two entities, A and B, and element A may link to many elements of B, vice versa. From our problem context, a Transaction entity may have more than one Service entities, and one Service entity may be included in more than one Transaction entities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLmYX-Rqh2Fwv8XueyRK3Q.png" /><figcaption>Many-to-Many Relationship Implementation in Service.java</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3ZLFlMmFNrRtVrNhAl-1w.png" /><figcaption>Many-to-Many Relationship Implementation in Transaction.java</figcaption></figure><p>First, we defined our List of Transaction in Service class along with other properties. Then, append the @ManyToMany annotation into transactionList as our List of Transaction instance. We need to defined a List of Service in the Transaction entity as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*VEzuASWYYIRmZKJnk5VPHQ.png" /><figcaption>Database Model Implementation 3</figcaption></figure><p>Finally, all the entities and their relations have been mapped into the database table. But why do we have two redundant tables, service_transaction_list and transaction_service_code? Don’t worry; we will fix this problem soon.</p><h3>Many-to-Many Relationship: Part 2</h3><p>Modify Service class with a few modifications by appending the required annotation as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ccdysg1rLEiwmUvMxZzPmw.png" /><figcaption>Improved Many-to-Many Relationship Implementation in Service.java</figcaption></figure><p>Add @JoinTable annotation into the Service class. The parameter name in the said annotation is arbitrary, but the rest has rules to follow. The joinColumn parameter should be an @JoinColumn with this class identifier as the name parameter. On the other hand, the inverseJoinColumn parameter is a @JoinColumn with target class identifier as the name parameter of the annotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*raOIMh4KvS1GfRK30jeiQA.png" /><figcaption>Improved Many-to-Many Relationship Implementation in Transaction.java</figcaption></figure><p>Then, in the target class, simply add the parameter mappedBy into our @ManyToMany parameter. This parameter is filled with the source instances we have seen before.</p><p><strong>Note:</strong> The source and target are arbitrary. You can use it interchangeably.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*G56MTpCLG8m-wFdUQq02Kg.png" /><figcaption>Database Model Implementation 4</figcaption></figure><p><em>Voila!</em> our database is a lot cleaner, isn’t it? Our database system is finished, and it is ready for writting business process.</p><h3>Further Reading</h3><p>This is a simple guide for developing Model Relationship on Spring Boot. There are a lot of improvements that you should make. I have put external links below for you to learn other improvements and components in Spring Boot:</p><ul><li><a href="https://medium.com/javarevisited/spring-transactional-mistakes-everyone-did-31418e5a6d6b">Spring @Transactional mistakes everyone did</a> by Aleksandr Kozhenkov</li><li><a href="https://medium.com/@bhagyajayashani/composite-key-handling-using-embeddedid-annotation-in-spring-boot-java-67c29da9d119">Composite key handling, using @EmbeddedId annotation in Spring boot java</a> by Bhagya Rupasinghe</li><li><a href="https://programmingsharing.com/most-used-spring-data-mongodb-annotations-589963d2ec34">Most used Spring Data MongoDB annotations</a> by Tranh Tran</li></ul><h3>Acknowledgement</h3><p>This article is the manifestation of my learning progress in Kampus Merdeka x Gojek internship program. Feel free to follow me to receive updates on my learning journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65fd614f07c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Way to be Adaptable in Workplace and Why Should be One.]]></title>
            <link>https://medium.com/@andhikayusup/practical-way-to-be-adaptable-in-workspace-and-why-should-be-one-a8fe683c61e4?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8fe683c61e4</guid>
            <category><![CDATA[workplace]]></category>
            <category><![CDATA[internship-experience]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[growth]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Sun, 05 Sep 2021 14:42:18 GMT</pubDate>
            <atom:updated>2021-09-06T08:59:47.868Z</atom:updated>
            <content:encoded><![CDATA[<h4>Guide For an Intern to be Adaptable in Your First Job.</h4><p>The last movie rented on Blockbuster was “This is the end” on November 9th, 2013; This marks the end of journey for the once a giant company in video-rental industry. Blockbuster was a big corporation in the on-demand business throughout the 90s and the early 2000s. But, in 2010, Blockbuster was delisted from NYSE and was officially declared bankrupt in 2014. One of the reasons for the downfall of this giant corporation is the failure to adapt to a new business model. Don’t get me wrong, this company has been considered to adjust and even tried (but failed) to buy Netflix for $50 million. But, they were clinging to their business model which depends on brick-and-mortar assets which made massive income on it back then. But, unfortunately this cash cow live were numbered and Blockbuster was too late to improvise.</p><figure><img alt="Photo by Sean Benesh on Unsplash" src="https://cdn-images-1.medium.com/max/1024/1*7OMCIOfELe0kEJrZ_zOORw.jpeg" /></figure><p>I love to bring up blockbuster case when I got the chance to talk about adaptability. Being adaptable with your surrounding is critical for your business and one-self. Failure to possess this skill will lead into your downfall because you are not relevant and valuable in this fast-changing world. This leads to make you less happy because you views changes as an obstacle rather than a new opportunity to grow. By being adaptable, you can be resilient to a new environment, for example a new workslace. This article will explain what viewpoint you should be looking into and how to adapt to those aspects.</p><p>As a person exposed to a new workplace, you will need to adjust for various concerns. This article will highlight five of those concerns that you should look into to excel in your career. The first concern is that you should adapt to ways of interacting. Since we are working with various people, there might be challenges because people have their own preferences to communicate and interact with. Second, you should pay attention to ways of working. Companies have their own values and cultures, so you should differentiate and assimilate into their cultures. Third, you should be able to adapt to ways of achieving. Most college students usually work individually, but in a work environment, things are achieved through teamwork. The rest is ways of learning and ways of thinking. Acknowledging these perspectives will grow yourself as a person and will help you through your journey on self-development.</p><h3>Ways of Interacting</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pUT8noAhQbIvxfqh" /><figcaption>Photo by <a href="https://unsplash.com/@priscilladupreez?utm_source=medium&amp;utm_medium=referral">Priscilla Du Preez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>People have their own preferred method of interaction. Some might enjoy talking in person, while others might prefer text-based communication. Acknowledging who you are and your own preferred method of interaction is a good headstart to adapt to your work environment. Over time as you interact with your coworkers, you will see their preferred communication methods. But, seeing their preferred communication methods is not enough. You have to work your way to understand and adapt to their preferences. Keep in mind that adapting to someone’s preference does not make you docile. But, it means that you welcome collaboration and being a fluid team player.</p><p>If you are working in a multinational company, you are most likely working with people of other nationalities. This condition will lead to a challenge for both of you because there will be a language barrier between you and your coworkers. It is worth trying to communicate with a language or medium that both of you understand, even though it is not perfect. Experience is the best teacher, right?</p><p>It is essential to resist associating specific behavior or stereotypes to a particular group of people. Try to be unbiased and be friendly to everyone regardless of their generation, race, or nationality.</p><h3>Ways of Working</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zm1NeJPG3kq5ZcxH" /><figcaption>Photo by <a href="https://unsplash.com/@nicole_yzq?utm_source=medium&amp;utm_medium=referral">Thea Ye</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>COVID-19 catastrophe has driven the digitalization of how we work in this century. It is not a secret that more company has enabled its workforce to have remote working scheme than the previous year. Adapting to this change better will able to make you survive company restructuration. Pandemic aside, working from home offer some benefits. You have more control of your working environment to be as comfortable as you like. Just make yourself at home (pun intended). Working at home also helps to cut unnecessary travel time to have more time to do anything else (like yoga) before work hours. Unfortunately, working from is a double-edged sword. Working from home is prone to procrastination and will likely limit yourself to deliver some value for your team. Your time management skill helps a lot when you have a working from home scheme. Try to build your credibility by being accountable for your work. Communicating your work progress will be able to get you the trust of your coworker and supervisor.</p><p>Working from the office also offers some benefits and advantages. Working from the office means that we can interact with coworkers to keep in touch with them. Benefits and advantages from work-from-home vary depending on the office layout. Two of well-known office format is Cubicle layout and Hot Desk layout. Unfortunately, we are not covering the differences between these office layouts, or else this article will be too long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*cyFry4dde9gwP0pJfgm48A.png" /><figcaption><a href="https://www.quinnassociation.com/en/culture_typology">Visualization by Robert E. Quinn and Kim S. Cameron</a></figcaption></figure><p>I found great visualization of what companies’ culture worldwide looks like by Robert E. Quinn and Kim S. Cameron. These company cultures were mold by the company’s values and the collective behavior of its employee. Understanding your company’s culture is essential to comprehend what your company and coworkers expected you to act.</p><h4>Clan Culture</h4><p>Companies with clan cultures see their employees as a big family. They promote collaboration, teamwork, and consensus between coworkers. This is the environment where employees support each other’s personal growth.</p><h4>Adhocracy Culture</h4><p>This type of culture incentivizes individual innovation and promotes the willingness to take risks. Mistakes are seen to be a chance to grow, and employees are encouraged to show their thoughts.</p><h4>Hierarchy Culture</h4><p>Hierarchy Culture has a clearly established structure with a long chain of commands. Decisions are made by the upper level so that every policy taken is carefully constructed. Usually, a company that has this culture is a company that has critical processes such as banks and government organizations.</p><h4>Market Culture</h4><p>The company that is driven by the market has this type of culture. This culture values a fast learner and competitive person to catch up with this fast-paced market.</p><h3>Ways of Achieving</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0sEDTHjhsVHZ5hPT" /><figcaption>Photo by <a href="https://unsplash.com/@nullplus?utm_source=medium&amp;utm_medium=referral">Razvan Chisu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Achieving things by yourself and through teamwork will put you in good bargaining power in the job market. In a workplace, things are achieved through collaboration. Teams have their shared goals and each task are carried out by its member. Hence, getting things done by yourself is not enough. To achieve team goals, you need to support, collaborate, and interact with coworkers. Moreover, An interdependent team can achieve more than doing it by yourself.</p><p>There is a good book discussing these matters, and you should take a look. The book title is <a href="https://www.amazon.com/Habits-Highly-Effective-People-Powerful/dp/0743269519">“The 7 Habits of Highly Effective People”</a> by Stephen Covey.</p><h3>Ways of Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aPISVMfOhm_6AHzK" /><figcaption>Photo by <a href="https://unsplash.com/@nickmorrison?utm_source=medium&amp;utm_medium=referral">Nick Morrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Nowadays, it is easier to access education to learn anything at any given time. The internet offers a vast amount of knowledge, and the only limit is knowing where to find what you are looking for. Mastering this skill will allow you able to learn any topic that you are interested in. For starters, here are a few ways for you to obtain knowledge:</p><h4>MOOC</h4><p>Massive Online Open Course (MOOC) let you get new skill with a structured curriculum. Most of the courses in MOOC are free to audit, but if you want a certification, you have to pay a certain amount of money. A few of the famous MOOC is <a href="https://www.coursera.org/">Coursera</a>, <a href="https://www.edx.org/">EdX</a>, and <a href="https://ocw.mit.edu/index.htm">MIT OpenCourseWare</a>.</p><h4>Community</h4><p>Offline or online tech communities are great places to meet people with common grounds. You can grow your connection and potentially meeting your mentors in the community. There is a considerable amount of communities with their own focus. For Example, Mozilla Indonesia, Debian GNU/Linux Indonesia, and GDG Indonesia.</p><h4>Mentoring</h4><p>Mentoring is a powerful way to gain knowledge directly from experiences. Learn from your mentor’s mistakes and following their path towards their success will help you achieve your goals faster. But, finding a good mentor is not easy and is not always available.</p><h3>Ways of Thinking</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9mFbVF5AbklUhVqw" /><figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">NeONBRAND</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The first thing that limits yourself of what you can and cannot do is <strong>your mind</strong>. Of course, some things cannot be changed, but developing a pearl of wisdom to tell the differences will improve your life. Moreover, adjusting your mind to the right mindset will make you adaptable and resilient enough to bounce back after each failure.</p><blockquote>“Whether you think you can, or you think you can’t — you’re right.”</blockquote><blockquote>— Henry Ford</blockquote><p>There are these popular terms introduced by Carol Dweck called <strong>Fixed Mindset </strong>and<strong> Growth Mindset </strong>on her book “<a href="https://www.amazon.ca/Mindset-Psychology-Carol-S-Dweck/dp/0345472322/ref=sr_1_1?crid=3EVKN4W8BC0UD&amp;keywords=growth+mindset+carol+dweck&amp;qid=1560274099&amp;s=books&amp;sprefix=growth+mindset+%2Cstripbooks%2C184&amp;sr=1-1">Mindset: The New Psychology of Success</a>”.</p><h4>Fixed Mindset</h4><p>Fixed Mindset is belief that you should avoid at all cost. People with this mindset will limit themself from their actual capabilities, and develop acceptance that it cannot be changed. For example:</p><ul><li>I am a programmer so I cannot do public speaking</li><li>I do not trust people</li></ul><h4>Growth Mindset</h4><p>On the other hand, a Growth Mindset is a belief that emphasizes learning and embracing criticism. This mindset believes that we can always learn over time and experience. Every challenge, every criticism, and every failure is a chance to grow and become a better self. There are several approaches to develop this kind of mindset, such as:</p><ul><li>Changing the wording of your thoughts to emphasize that you can make improvements. For example, instead of saying “I am a failure,” try to say, “Okay, I am sad for now, but what can I learn from my mistake?”</li><li>Identify your vulnerability and try to make an enhancement from it.</li><li>There is always room for learning.</li><li>Learn to give and take criticism.</li></ul><h3>Acknowledgement</h3><p>This article is the manifestation of my learning progress in Gojek internship program. The content of article are a stitches between soft skill training in Bangkit Academy, workshop in Gojek, and few personal notes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8fe683c61e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot Guide for Beginner: CRUD]]></title>
            <link>https://medium.com/javarevisited/spring-boot-guide-for-beginner-crud-c682d5437a0e?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/c682d5437a0e</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Sun, 05 Sep 2021 07:10:51 GMT</pubDate>
            <atom:updated>2021-09-23T14:11:59.437Z</atom:updated>
            <content:encoded><![CDATA[<h4>Guide for handling many HTTP Request: GET, POST, PUT, DELETE</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*ukqD-sZ54EgwgdjhuOCDPQ.png" /><figcaption>Header Image</figcaption></figure><p>Many projects sometimes separate backend and frontend services. It is an excellent practice to do separation of concern due to the security and maintainability of each service.</p><p>However, the problem that follows this approach is how to connect those services and make them talk. The frontend needs to access resources from the backend while using only the backend alone will frustrate the users.</p><p>This condition is where HTTP Requests come into play. Internet Engineering Task Force (IETF) made RFC 2616 that standardizes communicating to a hosting service. The document defines HTTP Request Methods for each typical web transaction.</p><p>These web transactions are collectively called CRUD operations, an acronym for Create, Read, Update, and Delete. The relationship between CRUD operations and HTTP Requests are described as follows:</p><ul><li>To create information, use the HTTP POST method.</li><li>To read information, use the HTTP GET method.</li><li>To update information, use the HTTP PUT method.</li><li>To delete information, use the HTTP DELETE method.</li></ul><p>This article will is a guide for implementing CRUD operations in Spring Boot. One of the benefits of using <a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e">Spring Boot</a> is its <a href="https://javarevisited.blogspot.com/2018/11/top-5-spring-boot-features-java.html#axzz6i534L5Aj">autoconfiguration</a>. So, you don’t have to worry about anything more than your business logic. The goal of this article is we wanted to do create, read, update, and delete operations on an Guest entity/model.</p><h3>Prerequisite</h3><p>In this instruction, few dependencies are needed and will not be covered by this article. Nevertheless, an external link for the instruction to install them is provided as a hyperlink below:</p><ul><li><a href="https://javarevisited.blogspot.com/2013/02/how-to-install-jdk-7-on-windows-8-java-32bit-64.html">JDK 1.8</a></li><li><a href="https://medium.com/javarevisited/7-best-courses-to-learn-intellij-idea-for-beginners-and-experienced-java-programmers-2e9aa9bb0c05?source=---------16------------------">IntelliJ IDEA</a></li><li><a href="https://medium.com/javarevisited/7-best-courses-to-learn-postman-tool-for-web-service-and-api-testing-f225c138fa5a">Postman </a>or any API testing tools</li></ul><h3>Hands-On Learning</h3><p>The starter code is provided by the link <a href="https://github.com/andhikayusup/springboot-startercode"><strong><em>here</em></strong></a><strong><em> </em></strong><em>to make it easier to get up and run</em><strong><em>. </em></strong>However, it is optional. You can always generate the starter code by yourself using <a href="https://start.spring.io/">Spring Initialzr</a>. Moreover, develop your own starter code if you prefer to use other Java versions or add additional dependencies. I have an article covering this matter; Please, go check it out.</p><p><a href="https://medium.com/@andhikayusup/spring-boot-guide-for-beginner-hello-world-64e248eec793">Spring Boot Guide for Beginner: Hello World</a></p><h4>Make a New Documents</h4><p>After cloning the repository (or generating your own starter code), open the source code using <a href="https://dev.to/javinpaul/5-best-courses-to-learn-intellij-idea-for-java-developers-5e6n">IntelliJ IDEA</a> or any IDE of your choice. Then, navigate into src/main/java/com/andhikayusup/learncrud the folder, where you do most of your work there. Make a new package/folder using IntelliJ IDEA by right-clicking on the parent folder then navigating to new -&gt; Package. You can follow the preceding instruction by the gif below.</p><figure><a href="https://javarevisited.blogspot.com/2018/09/top-5-courses-to-learn-intellij-idea-java-and-android-development.html"><img alt="" src="https://cdn-images-1.medium.com/max/600/1*DJRm1fHZTDdCpxN-piLV4A.gif" /></a><figcaption>Creating new package/folder using IntelliJ IDEA</figcaption></figure><p>After generating the guest folder, you will need to create additional files to follow up on this article. IntelliJ IDEA makes it easy to generate Java Class by right-clicking the guest folder and navigating to new -&gt; Java Class. This action will produce Java Class with some pre-filled template codes ready. You can follow the preceding instruction by the gif below.</p><figure><a href="https://www.java67.com/2018/08/top-10-free-java-courses-for-beginners-experienced-developers.html"><img alt="" src="https://cdn-images-1.medium.com/max/600/1*2SpB2xyd25OBVxTuobrEEw.gif" /></a><figcaption>Creating new Java Class using IntelliJ IDEA</figcaption></figure><p>To deliver a better code, we need to distribute production code into separate files so that each file has its own collective function. We can divide our implementation of CRUD operations into three files: Guest, GuestService, and GuestController.</p><p>In the <a href="https://medium.com/javarevisited/my-favorite-courses-to-learn-object-oriented-programming-and-design-in-2019-197bab351733">OOP paradigm</a>, we modeled the world as the interaction of Objects. A Class is a template for our Objects, and it defines default properties and methods. The first file we create is Guest.java which function as a Class for our problem. For this case, we have a Guest class with several properties and methods. The properties of this class are ID, full name, and age; meanwhile, the methods are the setter and getter for each property. The final code for this file should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9CC0_ZSNUjaPK_v7bReQxg.png" /><figcaption>Guest.java</figcaption></figure><p>The second file that we generate is GuestService. This is the file that should be the implementation of our business logic. We do not use stored databases like <a href="https://medium.com/javarevisited/7-best-free-postgresql-courses-for-beginners-to-learn-in-2021-3bf369d73794">PostgreSQL </a>for now; we will keep Guest objects as an ArrayList in our server in-memory. So, This file will implement the business logic of creating, retrieving, updating, and deleting those objects into our defined <a href="https://javarevisited.blogspot.com/2011/05/example-of-arraylist-in-java-tutorial.html#axzz6qVaG06bu">ArrayList</a>.</p><p>The code above has @Component annotations for our GuestService class. This annotation tells <a href="https://medium.com/javarevisited/10-advanced-spring-boot-courses-for-experienced-java-developers-5e57606816bd?source=collection_home---4------0-----------------------">Spring Boot</a> to instantiate them wherever we do dependency injection. Dependency Injection is one of Spring Boot’s advantages because it removes decoupling between classes. Amigoscode has a great video explaining this matter on his video <a href="https://www.youtube.com/watch?v=oqYRl06DNHQ">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1p70vYRp2kKj_Vot25RSIA.png" /><figcaption>GuestService.java</figcaption></figure><h4>REST Controller</h4><p>The third file that we should implement is GuestController. @RestController annotation used on this class tells Spring Boot that the class will be the REST Controller, the entry point for our services. In addition, @RequestMapping(&lt;path&gt;) is used to map at what path the said REST Controller controls a request. This REST Controller class will accept the request at api/v1/guest path for this problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZwpIVAKhQWEcQEtqpUk2A.png" /><figcaption>GuestController.java</figcaption></figure><p>Remember the <a href="https://javarevisited.blogspot.com/2017/11/difference-between-component-service.html">@Component</a> annotation that we declared on GuestService.java? We will instantiate the GuestService using <a href="https://javarevisited.blogspot.com/2012/12/inversion-of-control-dependency-injection-design-pattern-spring-example-tutorial.html#axzz6u4HTHz4Z">dependency injection</a> on this class. To perform this action, first, we need to implement the constructor of GuestController class with the GuestService object as its parameters. Then, we use @Autowired annotation to indicate Spring Boot that we used dependency injection.</p><h4>Handle GET Request</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dk0LX5jAQAuiqlLDTxHF2A.png" /></figure><p>HTTP GET method is commonly used to read data from the hosting service. @GetMapping is used to indicate that said method is a handler for the GET request method.</p><p>The implementation of this handler is quite simple. We just need to return the output of the getGuests method that we defined in the GuestService class.</p><h4>Handle POST Request</h4><figure><a href="https://www.java67.com/2017/11/top-5-free-core-spring-mvc-courses-learn-online.html"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VvCYh2WMXh7wVcIn3hOu3A.png" /></a></figure><p>A method has to use @PostMapping annotation so that Spring Boot can tell that this method is a handler for <a href="https://javarevisited.blogspot.com/2015/10/how-to-send-http-request-from-unix-or-linux-curl-wget-example.html">POST requests</a>.</p><p>The goal of this method is to save guest information from a user into the system. We decided to require users to put their data in the Request Body. <a href="https://medium.com/javarevisited/top-10-free-courses-to-learn-spring-framework-for-java-developers-639db9348d25">Spring Boot</a> made it easy to extract all the information provided by the user in the Request Body <strong>directly</strong> into an instance of Guest class.</p><p>This can be done by attaching @RequestBody annotations into a parameter. Then, call the addGuest method in GuestService class to insert those data into our (in-memory) database. Last, we need to return that instance to our user to be processed further by frontend services.</p><h4>Handle DELETE Request</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P97Hl8ImTWS68J93qzQddQ.png" /><figcaption>HTTP DELETE Handler</figcaption></figure><p>If we wanted to instruct to delete a piece of information on our service, the HTTP DELETE Request method is the proper method for performing. A method uses @DeleteMapping(&lt;Path&gt;) annotation so that <a href="https://medium.com/hackernoon/top-5-spring-boot-and-spring-cloud-books-for-java-developers-75df155dcedc">Spring Boot </a>can tell that this method is a handler for DELETE Requests. We design the API path so that we include additional information for our target guest ID number. Retrieving information in that API path is easy. We just need to put the @PathVariable(&lt;var&gt;) method into the function parameter.</p><p>Then, we pass those guest ID into the deleteGuest method in GuestService class as the parameter to perform information deletion. This function does not return any data, so the best practice is to tell our user a 204 No Contentresponse status.</p><h4>Handle PUT Request</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*77pBGDJWKt7X3QgbYxLo_A.png" /><figcaption>HTTP PUT Handler</figcaption></figure><p>A method has to use @PutMapping annotation so that Spring Boot can tell that this method is a handler for <a href="https://javarevisited.blogspot.com/2016/10/difference-between-put-and-post-in-restful-web-service.html">HTTP PUT Request</a>s. Same as HTTP DELETE Request, we also put guest id information in our path variable. In addition, We also need other information on our path variable as a Request Parameter. To be able to do this, we should put @RequestParams(required=false) annotations to target parameters. The difference between Request Parameter and Path Variable is we can set Request Parameter to optional.</p><p>Although the end result is must not be the same, if you follow this article instruction, the final code of GuestController.java should be look like the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hmZ3Zgp8vGTy6gm6NCUsFw.png" /><figcaption>GuestController.java Full Implementation</figcaption></figure><h3>Result</h3><p>If you follow this guide up to this section, congratulations! You just need to run the application so that we can test our service. We are going to perform CRUD operation to the service using <a href="https://medium.com/javarevisited/6-best-rest-api-tools-for-testing-design-and-development-1c5f69ed1f22">Postman</a>. I shared the API collection so you can just import it to Postman by the link below.</p><pre><a href="https://www.getpostman.com/collections/14480a416e8c1e3d9963">https://www.getpostman.com/collections/14480a416e8c1e3d9963</a></pre><p>Follow this GIF below to test our web application using Postman API Testing tools:</p><figure><a href="https://javarevisited.blogspot.com/2020/02/top-5-postman-tutorials-and-courses-for-web-developers.html"><img alt="" src="https://cdn-images-1.medium.com/max/600/1*S8qOG7S1wTNTTR4COoLYvg.gif" /></a><figcaption>CRUD API Testing</figcaption></figure><h3>Further Reading</h3><p>This is a simple guide for developing CRUD operations on Spring Boot. There are a lot of improvements that you should make. I have put external links below for you to learn other improvements and components in Spring Boot:</p><ul><li><a href="https://medium.com/wolox/securing-applications-with-jwt-spring-boot-da24d3d98f83">Securing applications with JWT Spring Boot</a> by Ignacio Oliveto</li><li><a href="https://medium.com/clover-platform-blog/building-a-microservice-with-spring-boot-and-spring-cloud-1c8275d7d229">Building a Microservice with Spring Boot and Spring Cloud</a> bt Clover Platform</li><li><a href="https://tiagoamp.medium.com/graphql-with-java-and-spring-boot-a081839122ad">GraphQL with Java and Spring Boot</a> by Tiago Albuquerque</li></ul><p>Special shout out to <a href="https://www.youtube.com/user/djdjalas">Amigoscode</a>. His great and easy-to-understand content really help me to understand Spring Boot. Please go check his Youtube channel and don’t forget to subscribe.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c682d5437a0e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/spring-boot-guide-for-beginner-crud-c682d5437a0e">Spring Boot Guide for Beginner: CRUD</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[Spring Boot Guide for Beginner: Hello World]]></title>
            <link>https://medium.com/@andhikayusup/spring-boot-guide-for-beginner-hello-world-64e248eec793?source=rss-26c8068337ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/64e248eec793</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Andhika Yusup]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 03:20:30 GMT</pubDate>
            <atom:updated>2021-10-25T14:10:45.060Z</atom:updated>
            <content:encoded><![CDATA[<h4>Get your Spring Boot project running with this easy set up</h4><p>There are a lot of frameworks for you to build a web application; one of them is Spring Boot. This article will be a step-by-step guide for you to learn the basic setup of this excellent framework. Spring Boot is quite popular, so learning it will put you in a good position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*OusGJQxUSe-YhaH5ZVLx4A.png" /><figcaption>Based on <a href="https://insights.stackoverflow.com/survey/2021#technology-most-popular-technologies">Stack Overflow Developer Survey 2021</a></figcaption></figure><p>Spring is one of the popular frameworks that you can use to build production-grade applications. Based on a survey by Stack Overflow in 2021, Spring is listed as the ten most used framework by developers. One of the substantial benefits that Spring can offer is the dependency injection feature. This feature let you reduce the amount of coupling in your code so that it can be modular.</p><p>Spring Boot was built on top of Spring Framework, making it easy for developers to use it. Spring Boot help you create a web application with minor to no configuration. This framework takes an opinionated approach to get you to develop your product faster with less boilerplate code. An opinionated framework means you will have an established application structure when you first initiate your project. Another web framework that took this approach is Ruby on Rails, Django, and Laravel.</p><h3>Prerequisite</h3><p>To be able to use this guide, you will require to install a few dependencies first. But don’t worry, I put an external link for the manual for installing them. You’ll need:</p><ul><li><a href="https://www.guru99.com/install-java.html">JDK 1.8</a></li><li>Your favorite code editor (<a href="https://www.jetbrains.com/help/idea/installation-guide.html">IntelliJ</a> preferred)</li></ul><h3>Spring Initializer</h3><p>With Spring Boot, you can also customize your starter code so that there are no unused code. This customization can be done with just a few simple click with Spring Initializr. For this guide, you will need to add Spring Web as its dependencies and use Java 8. Feel free to modify project metadata to be your own. You can access Spring Initializr tool by the link <a href="https://start.spring.io/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8SKuzmYYKM9GoG5zxm4vg.png" /></figure><p>After setting up the Java version and project dependencies, click generate button to compile the starter code and then it automatically download to your computer. Unzip the starter code and open the folder with your favourite code editor or IDE to get a deep dive into Spring Boot.</p><h3>Dive into Spring Boot</h3><p>When you first open the project folder, there were many documents already set up for you. Spring Boot has a clearly established structure so that you just put more effort into writing your business logic. As a beginner in Spring Boot, you will mainly be working in the ./src folder. In that folder, you will find two folders: main and test. Production code will be written in the main folder; meanwhile, the unit tests will fill the test folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*AuUFFz9DezmHi-VfrTN4Tg.png" /><figcaption>Spring Boot folder structure</figcaption></figure><p>For this simplicity of guide, you will only modify DemoApplication.java file located in ./src/main/java/com/example/demo/. Follow these steps below to modify our starter code to be able to print hello world to our client:</p><ol><li>Add @RestController annotation to DemoApplication class</li><li>Implement a new function that returns the string “Hello, World!”</li><li>Add @GetMapping annotation into the newly implemented function.</li><li>Run the application</li></ol><p>The final modification should look like the code provided below. It is okay to improvise as long as you can run the application without any errors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9157111c1f6b1fd5e0c9ceeb829a049f/href">https://medium.com/media/9157111c1f6b1fd5e0c9ceeb829a049f/href</a></iframe><p>In this guide you already see @RestController and @GetMapping annotations. You will see a lot of annotation in the Spring Boot framework. But, don’t get overwhelmed; over time, you will understand what each of these annotations is for.</p><ul><li>@RestController is an annotation that tells Spring Boot that this class is a controller component and can handle HTTP Requests.</li><li>A function that has @GetMapping means that that function is a handler for GET requests. This annotation should be inside a class that has @RestController annotation to work correctly. Another variation for this annotation is @PostMapping, @DeleteMapping, and @PutMapping.</li></ul><h3>Result</h3><p>If you managed to compile the project without any errors, you would be rewarded by seeing this output in the address localhost:8080. Congratulations! You have taken a first step in mastering this framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muqt1qg4mVDQNpjli3rv3g.png" /><figcaption>“Hello, World!” output by Spring Boot</figcaption></figure><h3>Further reading</h3><p>There are still a lot to learn in order to master Spring Boot. I have compiled learning source for you to read below:</p><ul><li><a href="https://medium.com/wolox/securing-applications-with-jwt-spring-boot-da24d3d98f83">Securing applications with JWT Spring Boot by Ignacio Oliveto</a></li><li><a href="https://programmingsharing.com/an-overview-of-spring-data-jpa-f7503f06add9">Spring Data JPA-The Overview by Tranh Tran</a></li><li><a href="https://medium.com/clover-platform-blog/building-a-microservice-with-spring-boot-and-spring-cloud-1c8275d7d229">Building a Microservice with Spring Boot and Spring Cloud</a></li></ul><p>Special shout out to <a href="https://www.youtube.com/user/djdjalas">Amigoscode</a>. His great and easy to understand content really help me into understanding Spring Boot. Please go check his Youtube channel and don’t forget to subscribe.</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64e248eec793" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>