<?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 Revda Uluışık on Medium]]></title>
        <description><![CDATA[Stories by Revda Uluışık on Medium]]></description>
        <link>https://medium.com/@revda?source=rss-746c9c0b5f2c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fsW2T3UMlzEXyI5t</url>
            <title>Stories by Revda Uluışık on Medium</title>
            <link>https://medium.com/@revda?source=rss-746c9c0b5f2c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:23:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@revda/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[Introduction to Spring Boot]]></title>
            <link>https://medium.com/adessoturkey/introduction-to-spring-boot-458cb814ec14?source=rss-746c9c0b5f2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/458cb814ec14</guid>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Revda Uluışık]]></dc:creator>
            <pubDate>Sat, 26 Jun 2021 06:20:52 GMT</pubDate>
            <atom:updated>2021-06-30T08:45:40.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*S1DSvVJ4OEWiKFVLMVl3iQ.png" /></figure><p>Spring Boot is a project that is built on top of the Spring Framework. It provides an easier and faster way to set up, configure, and run both simple and web-based applications.</p><p>It is a Spring module that provides the RAD (Rapid Application Development) feature to the Spring Framework used to create a stand-alone Spring-based application that you can just run because it needs minimal Spring configuration.</p><p>As summarized in the below figure, Spring Boot is the combination of Spring Framework and Embedded Servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*8BxamdFNNZIFSnv5z5HijQ.png" /></figure><p><strong>How did Spring Boot originate?</strong><br>The Spring framework has gained the interest of the Java developer’s community as a lightweight alternative to EJB and became one of the most popular application development frameworks.</p><p>It consists of a large number of modules providing a range of services including a component container, ASP support, security framework, data access framework, web application framework, support classes for testing components and etc.</p><p>Collecting all the required spring components together, setting up library dependencies in gradle/maven, and then configuring the required spring beans using xml, annotations, or java code requires quite an effort within the Spring framework.</p><p><strong><em>This is where the Spring Boot Project comes into play!!!</em></strong></p><p>Spring boot is already a launchable app. Depending on what Spring launcher class you extend, it might be a cli app or a web app. To add more stuff to the app you just have to add dependencies to the project. That’s it…</p><p><strong>Spring Boot Architecture</strong></p><p>In Spring Boot, there is no requirement for XML configuration (deployment descriptor). It uses <a href="https://en.wikipedia.org/wiki/Convention_over_configuration">convention over configuration</a> software design paradigm which means that it decreases the effort of the developer.</p><p>The main goal of Spring Boot is to reduce development, unit test, and integration test time and leveraging the following features:</p><ul><li>Create stand-alone Spring applications</li><li>Embed Tomcat, Jetty, or Undertow directly (no need to deploy WAR files)</li><li>Provide opinionated ‘starter’ POMs to simplify your Maven configuration</li><li>Automatically configure Spring whenever possible</li><li>Provide production-ready features such as metrics, health checks, and externalized configuration</li><li>Absolutely no code generation and no requirement for XML configuration</li></ul><p>Spring Boot follows a layered architecture in which each layer communicates with the layer directly below or above (hierarchical structure) it. The below diagram demonstrates that every layer of a Spring Boot application is directly communicating with the layer just below or above it is due to the workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*sd0a5jrfn8lyYCXzimLB5Q.png" /></figure><p><strong>Presentation Layer:</strong> The presentation layer handles the HTTP requests, translates the JSON parameter to object, and authenticates the request, and transfer it to the business layer. In short, it consists of views. <br><strong>Business Layer: </strong>The business layer handles all the business logic. It consists of service classes and uses services provided by data access layers. It also performs authorization and validation.<br><strong>Persistence Layer:</strong> The persistence layer contains all the storage logic and translates business objects from and to database rows.<br><strong>Database Layer:</strong> In the database layer, CRUD (create, retrieve, update, delete) operations are performed.</p><p>Spring Boot uses all the modules of Spring-like Spring MVC, Spring Data, etc. The architecture of Spring Boot is the same as the architecture of Spring MVC, except for one thing: there is no need for DAO and DAOImpl classes in Spring boot. As a summary, in a simple spring boot flow:</p><ul><li>Data access layer gets created and CRUD operations are performed.</li><li>The client makes the HTTP requests.</li><li>The request goes to the controller, and the controller maps that request and handles it. After that, it calls the service logic if required.</li><li>In the service layer, all the business logic performs. It performs the logic on the data that is mapped to JPA with model classes.</li><li>A response page is returned to the user if no error occurs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*q9aWC1rxS55WUSEOAnvEdw.png" /></figure><p><strong>Spring Boot Annotations</strong><br>Spring Boot Annotations is a form of metadata that provides data about a program. Spring Boot Annotations are mostly placed in the following packages:</p><ul><li>org.springframework.boot.autoconfigure</li><li>org.springframework.boot.autoconfigure.condition</li></ul><p><strong><em>Detailed information is given on the follow-up blog → </em></strong><a href="https://revda.medium.com/basic-spring-spring-boot-annotations-6fd44b1de853"><strong><em>Basic Spring &amp; Spring Boot Annotations</em></strong></a></p><p><strong>Spring Boot Components</strong><br>The Spring Boot Project provides four key features to begin with and these can be considered as the reason behind Spring Boot’s magic.</p><ul><li>Spring Boot Starters</li><li>Automatic configuration</li><li>Spring Boot CLI</li><li>Spring Boot Actuator</li></ul><p><strong><em>Detailed information is given on the follow-up blog → </em></strong><a href="https://medium.com/@revda/spring-boot-components-6a2759722d6b"><strong><em>Spring Boot Components</em></strong></a></p><p><strong>Spring Boot CLI</strong><br>Spring Boot also provides a command-line tool that can be used to quickly write Spring applications. You can run Groovy scripts with Spring Boot CLI. Groovy code has almost zero boilerplate code compared with Java.</p><blockquote>The Spring Boot documentation says:<br>“You don’t need to use the CLI to work with Spring Boot but it’s definitely the quickest way to get a Spring application off the ground.”</blockquote><ul><li>Spring Boot’s CLI gives you more free time from having to add starter dependencies and auto-configuration to let you focus only on writing your application-specific code.</li><li>What about dependent libraries? We don’t have Maven or Gradle here. CLI is smart; it detects classes being used in your application and it also knows which Starter dependencies should be used for these classes; accordingly, Spring Boot CLI adds dependencies to the classpath to make it work.<br>As Spring Boot CLI adds dependencies, a series of auto-configuration kicks in and adds the required bean method configuration so that your application is able to respond to HTTP requests.</li><li>CLI is an optional feature of Spring Boot; it just allows you to write a complete application with your application code only as, it doesn’t need to build a traditional project. CLI provides tremendous power and simplicity for Spring development.</li></ul><p><strong>Spring Boot Actuator</strong><br>There are a lot of frameworks that provide tools for application development. But Spring Boot doesn’t only provide application development-specific features; it also provides post-production features. This allows you to monitor your Spring application during production using HTTP endpoints or with JMX.<br>Other parts of Spring Boot’s building blocks simplify Spring development; the Actuator instead offers the ability to inspect the internals of your application at runtime. <br>The Actuator provides data on auditing, metrics, and the health of your Spring Boot application using HTTP endpoints or with JMX. It helps you to manage your application when it’s in production.</p><p>The Actuator installed in a Spring Boot application provides the following benefits:</p><ul><li>It provides details of all beans configured in the Spring application context</li><li>It also ensures all environment variables, system properties, configuration properties, and command-line arguments are available to your application</li><li>The Actuator gives various metrics pertaining to memory usage, garbage collection, web requests, and data source usage</li><li>It provides a trace of recent HTTP requests handled by your application</li><li>It also gives information about the current state of the threads in the Spring Boot application</li></ul><p>Now that we have gone through the very basics of spring boot let’s take a look at its advantages and disadvantages.</p><p><strong>Advantages</strong></p><ul><li>Simplified &amp; version conflict-free dependency management through the starter POMs.</li><li>We can quickly set up and run standalone, web applications, and microservices.</li><li>Reduces the time spent on development and increases the overall efficiency of the development team.</li><li>Helps to avoid all the manual work of writing boilerplate code, annotations, and complex XML configurations. The beans are initialized, configured, and wired automatically.</li><li>Facilitates the creation and testing of Java-based applications by providing a default setup for unit and integration tests.</li><li>You can just assemble the jar artifact which comes with an embedded Tomcat, Jetty, or Undertow application server and you are ready to go.</li><li>The Spring Initializer provides a project generator to make you productive with a certain technology stack from the beginning.</li><li>The integration of Spring Boot with the Spring ecosystem which includes Spring Data, Spring Security, Spring ORM, and Spring JDBC is easy.</li><li>Provides many plugins that developers can use to work with embedded and in-memory databases smoothly and readily.</li><li>Allows for easy connection with database and queue services like Oracle, PostgreSQL, MySQL, MongoDB, Redis, Solr, ElasticSearch, Rabbit MQ, ActiveMQ, and many more.</li><li>Offers easy access to Command Line Interface which makes the development and testing of Spring Boot apps built with Java or Groovy agile.</li></ul><p><strong>Disadvantages</strong></p><ul><li>Spring boot may unnecessarily increase the deployment binary size with unused dependencies.</li><li>If you are a control freak, I doubt Spring Boot would fit your needs.</li><li>Spring Boot sticks well with microservices. The Spring Boot artifacts can be deployed directly into Docker containers. In large and monolithic applications it is not encouraged much.</li><li>If you have never worked with Spring before and want to learn about proxies, dependency injection, and AOP programming, it is not recommended to start with Spring Boot because it will make you miss many concepts that you would grasp if you had started using them independently.</li><li>You really have to understand a lot of the underlying Spring systems (and a bit of Spring history too), along with some advanced topics in order to modify and troubleshoot it.</li></ul><blockquote>***********Thank you for reading************ **********************************************</blockquote><p><strong>References</strong></p><ul><li><a href="https://spring.io/projects/spring-boot">https://spring.io/projects/spring-boot</a></li><li><a href="https://www.baeldung.com/spring-boot">https://www.baeldung.com/spring-boot</a></li><li><a href="https://dzone.com/articles/spring-boot-framework-tutorials">https://dzone.com/articles/spring-boot-framework-tutorials</a></li><li><a href="https://www.educba.com/what-is-spring-boot/">https://www.educba.com/what-is-spring-boot/</a></li><li><a href="https://www.javatpoint.com/spring-boot-tutorial">https://www.javatpoint.com/spring-boot-tutorial</a></li><li><a href="https://techrocking.com/what-is-spring-boot-auto-configuration/">https://techrocking.com/what-is-spring-boot-auto-configuration/</a></li><li><a href="https://www.marcobehler.com/guides/spring-boot">https://www.marcobehler.com/guides/spring-boot</a></li><li><a href="https://medium.com/javarevisited/spring-boot-with-embedded-tomcat-pros-and-cons-84da418e7af1">https://medium.com/javarevisited/spring-boot-with-embedded-tomcat-pros-and-cons-84da418e7af1</a></li><li><a href="https://rabbitstack.github.io/spring/spring-boot-or-not-to-spring-boot/">https://rabbitstack.github.io/spring/spring-boot-or-not-to-spring-boot/</a></li><li><a href="https://devrant.com/rants/1867059/spring-vs-spring-boot">https://devrant.com/rants/1867059/spring-vs-spring-boot</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=458cb814ec14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/introduction-to-spring-boot-458cb814ec14">Introduction to Spring Boot</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Key Features of the Spring Boot Project]]></title>
            <link>https://medium.com/adessoturkey/spring-boot-components-6a2759722d6b?source=rss-746c9c0b5f2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a2759722d6b</guid>
            <dc:creator><![CDATA[Revda Uluışık]]></dc:creator>
            <pubDate>Sat, 26 Jun 2021 06:20:45 GMT</pubDate>
            <atom:updated>2021-06-30T08:57:40.637Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QBkARKLKHj-B6FyVOk77Hw.png" /></figure><p>The Spring Boot Project provides four key features to begin with and these can be considered as the reason behind Spring Boot’s magic.<br>• Spring Boot Starters<br>• Automatic configuration<br>• Spring Boot CLI <br>• Spring Boot Actuator</p><p><strong>Spring Boot Starters</strong><br>The starters are basically a set of dependency descriptors containing most of the dependencies that you need to get a project up and running quickly and with a consistent, supported set of managed transitive dependencies.</p><p>They are like small Spring projects for each module such as web MVC, JDBC, ORM, and so on. For a Spring application, you just add the starters of the respective module in the classpath, and Spring Boot will ensure that the necessary libraries are added to the build by using Maven or Gradle.</p><ul><li>Additional dependencies may be added, but in most cases, the starter is sufficient for a particular category of project.</li><li>More than one starter can be used in pom.xml</li><li>All official starters follow a similar naming pattern; spring-boot-starter-*, where * is a particular type of application. This naming structure is intended to help when you need to find a starter.</li></ul><p>Below are some example usages of common starters in a pom.xml :</p><p><strong>spring-boot-starter-web :</strong><br>Suppose you want to create a web application or an application to expose RESTful services using the Spring web MVC module to your Spring application. <br>Below would be how this starter is added as a dependency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*eZuvLWKpklNZn-exAWCnNA.png" /></figure><p>This starter dependency resolves the following transitive dependencies:<br>• spring-web-*.jar<br>• spring-webmvc-*.jar<br>• tomcat-*.jar<br>• jackson-databind-*.jar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*uiyMxiQC9J7bN52TaQ7X_A.png" /></figure><p>The spring-boot-starter not only reduces the build dependency count but also adds specific functionality to the build. Adding the web starter to a Spring application provides the web functionality that the application needs.</p><p><strong>spring-boot-starter-test :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*NCsMYxTOknxRA9KWYsMd3w.png" /></figure><p><strong>spring-boot-starter-data-jpa with embedded H2 database :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*P90Wp1eTMPumj6VW3fFCWg.png" /></figure><blockquote>Spring Boot provides a wide range of Starter projects. The following application Starters can be found under the org.springframework.boot group:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*rLwYKSRqmikwTx_HGqrarg.png" /></figure><p><strong>Spring Boot Starter Parent POM</strong><br>The Starter Parent POM defines key versions of dependencies and Maven plugins. It typically uses spring-boot-starter-parent as the parent in the pom.xml file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*kMpJZQ6uGTCI2oNOhgDzMQ.png" /></figure><p>Spring Boot Starter Parent POM is an easy way to bring in multiple coordinated dependencies including transitive dependencies allowing us to manage the following things for multiple child projects and modules:</p><ul><li>Configuration: Java version and other properties</li><li>Dependency management: Version of dependencies</li><li>Default plugin configuration: This includes configurations such as build plugins</li></ul><p><strong>Spring Boot auto-configuration</strong><br>Spring Boot can automatically provide configuration for application functionality, which is common to many Spring applications.</p><p>Spring Boot offers auto-configuration of the modules in your Spring application based on the JAR dependencies that you have added.</p><p>Suppose you add the JPA starter dependency (spring-boot-starter-data-jpa) in your Spring application classpath;</p><ul><li>Spring Boot attempts to automatically configure JPA to your Spring application where you don’t configure any database connection beans related to JPA manually.</li></ul><p>Similarly, if you want to add an in-memory database such as HSQLDB, just add it (org.hsqldb) in the classpath of your Spring application, and it will auto-configure an in-memory database.</p><p>Spring Boot provides the auto-configuration feature in the following ways:</p><ul><li>First, Spring Boot looks for frameworks available on the classpath</li><li>After that, it checks the existing configuration for the application</li></ul><p>Spring Boot Starter reduces a build’s dependencies and Spring Boot auto-configuration reduces the Spring configuration.</p><p>Based on these points, Spring Boot provides the basic configuration needed to configure the application with these frameworks. This is called auto-configuration.</p><p><strong>Enabling Spring Boot auto-configuration</strong><br>Spring Boot provides the @EnableAutoConfiguration annotation that is responsible for enabling the auto-configuration feature.</p><p>This annotation is used in the main application file of the Spring Boot application.</p><p>The @EnableAutoConfiguration annotation on a Spring Java configuration class causes Spring Boot to automatically create beans it thinks you need, usually based on classpath contents that it can easily override.</p><p>Let’s see the following code that represents the main application launcher class in the Spring Boot application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*G-izX_PhQSoPVj9CYWzNdg.png" /></figure><p>It is very common to use @EnableAutoConfiguration, @Configuration, and @ComponentScan together. But, Spring Boot also provides a shortcut for this configuration file by using another annotation, @SpringBootApplication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*i_-FeLxKhpli-W_UmJ6ICQ.png" /></figure><blockquote>Note: @SpringBootApplication has been available since Spring Boot 1.2.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*k0zU8Fu2MDUSPxA0l0Qccw.png" /></figure><p>In this diagram, we can say that the @SpringBootApplication annotation has composed functionality from three annotations : @EnableAutoConfiguration, @ComponentScan, and @Configuration.</p><p>If you want to exclude auto-configuration for some of the modules, then you use the exclude property of @SpringBootAnnotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*JdrF1sf3VLUet6cuSMrIlA.png" /></figure><p>As you can see in the code, this Spring Boot application will consider DataSourceAutoConfiguration.class and HibernateJpaAutoConfiguration.class for the auto-configuration.</p><p>The following diagram demonstrates the Spring Boot auto-configuration feature:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*r5TVkJOcMJJmp0H3egrdMg.png" /></figure><p>As you can see in the diagram, you just include the required modules in your Spring application. At runtime, Spring Boot checks libraries at the classpath of your application. If the required libraries are available on the classpath of your application, then Spring Boot configures the required beans and other configurations for your application. You don’t need to worry about the configuration of the modules in the Spring Boot application.</p><blockquote>***********Thank you for reading************ **********************************************</blockquote><p><strong>References</strong></p><ul><li><a href="https://spring.io/projects/spring-boot">https://spring.io/projects/spring-boot</a></li><li><a href="https://www.baeldung.com/spring-boot">https://www.baeldung.com/spring-boot</a></li><li><a href="https://dzone.com/articles/spring-boot-framework-tutorials">https://dzone.com/articles/spring-boot-framework-tutorials</a></li><li><a href="https://www.educba.com/what-is-spring-boot/">https://www.educba.com/what-is-spring-boot/</a></li><li><a href="https://www.javatpoint.com/spring-boot-tutorial">https://www.javatpoint.com/spring-boot-tutorial</a></li><li><a href="https://techrocking.com/what-is-spring-boot-auto-configuration/">https://techrocking.com/what-is-spring-boot-auto-configuration/</a></li><li><a href="https://www.marcobehler.com/guides/spring-boot">https://www.marcobehler.com/guides/spring-boot</a></li><li><a href="https://medium.com/javarevisited/spring-boot-with-embedded-tomcat-pros-and-cons-84da418e7af1">https://medium.com/javarevisited/spring-boot-with-embedded-tomcat</a></li><li><a href="https://medium.com/javarevisited/spring-boot-with-embedded-tomcat-pros-and-cons-84da418e7af1">pros-and-cons-84da418e7af1</a></li><li><a href="https://rabbitstack.github.io/spring/spring-boot-or-not-to-spring-boot/">https://rabbitstack.github.io/spring/spring-boot-or-not-to-spring-boot/</a></li><li><a href="https://devrant.com/rants/1867059/spring-vs-spring-boot">https://devrant.com/rants/1867059/spring-vs-spring-boot</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a2759722d6b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/spring-boot-components-6a2759722d6b">Key Features of the Spring Boot Project</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Spring & Spring Boot Annotations]]></title>
            <link>https://medium.com/adessoturkey/basic-spring-spring-boot-annotations-6fd44b1de853?source=rss-746c9c0b5f2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd44b1de853</guid>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Revda Uluışık]]></dc:creator>
            <pubDate>Fri, 25 Jun 2021 16:58:58 GMT</pubDate>
            <atom:updated>2021-06-30T09:07:33.119Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Ag_rBGepV3fpPNIfPZ1Llg.png" /></figure><p>Spring Boot Annotations is a form of metadata that provides data about a program. Annotations are a form of hints that we can give about our program to the compiler and runtime. Based on these hints, the program can be processed differently.</p><p>Spring Boot relies on annotations extensively to define and process bean definitions. Some of the features we discuss here will be from Spring Framework since Spring Boot itself is an opinionated version of Spring.</p><p>Spring Boot Annotations are mostly placed in the following packages:</p><ul><li>org.springframework.boot.autoconfigure</li><li>org.springframework.boot.autoconfigure.condition</li></ul><p>We will be looking into these annotations in 3 sections:</p><ul><li>Spring Boot and Web annotations</li><li>Spring Framework annotations</li><li>Spring Cloud annotations</li></ul><h4>Spring Boot and Web annotations</h4><p>Below are some of the basic spring boot and web annotations that are used to configure a web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*-ZunS4QwK7i5fOA3rqUnpA.png" /><figcaption><strong>Spring Boot and Web annotations</strong></figcaption></figure><ul><li><strong>@Controller</strong> is used to mark classes as Spring MVC Controller.</li><li>@RestController is a convenience annotation that adds up the @Controller and @ResponseBody annotations</li></ul><p>So the following controller definitions should do the same:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*x-J2yn5Mc9IeRFdiGH3QOg.png" /></figure><p>If we look at what happens behind the scene, the flow of request in a @Controller class without using a @ResponseBody annotation is as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*4pwHVxXu30tyokX5TO1sUg.png" /></figure><p>On the other side, @RestController returns an object as a response instead of view as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*37kECLofUd70-NJ_GtCpZg.png" /></figure><h4>Spring Framework annotations</h4><p>Spring uses dependency injection to configure and bring your application together. It means that you just declare the components of your system and how they interact. Then Spring wires it all together at runtime. Here are the most important Spring Framework annotations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSHpHp2iH7YkGvZ7oKW8dw.png" /><figcaption><strong>Spring Framework annotations</strong></figcaption></figure><blockquote>Spring beans are all in singleton scope by default. But you have to keep in mind is that you should not store state in field variables meaning that they should only hold dependencies.<br>This keeps your application thread-safe, and you do not require a new instance of a bean each time. In other words, your beans are stateless.</blockquote><p>@Service, @Controller, and @Repository are the specialized form of @Component annotation for certain situations. Instead of using @Component on a controller class in Spring MVC, we use @Controller, which is more readable and appropriate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*tghrJeiOVTvPKOsRLw3Ggg.png" /></figure><ul><li>By using @Controller annotation we do two things, first, we declare that this class is a Spring bean and should be created and maintained by Spring ApplicationContext, but also we indicate that it is a controller in MVC setup.</li><li>This property is then used by web-specific tools and functionalities.</li><li>For example, DispatcherServlet looks for @RequestMapping on classes that are annotated using @Controller but not with @Component.</li><li>This means @Component and @Controller are the same with respect to bean creation and dependency injection but later is a specialized form of the former.</li><li>Even if you replace @Controller annotation with @Component, Spring can automatically detect and register the controller class but it may not work as you expect with respect to request mapping.</li></ul><p>The same is true for @Service and @Repository annotation, they are a specialization of @Component in the service and persistence layer.</p><ul><li>A Spring bean in the service layer should be annotated using @Service instead of @Component annotation and a spring bean in the persistence layer should be annotated with @Repository annotation.</li><li>By using a specialized annotation we hit two birds with one stone. First, they are treated as Spring beans, and second, you can put special behavior required by that layer.</li><li>For example, @Repository’s not only helping in annotation-based configuration but also catch Platform-specific exceptions and re-throw them as one of Spring’s unified unchecked exceptions. Though for that you also need to declare org.springframework.dao.annotation. PersistenceExceptionTranslationPostProcessor as Spring bean in your application context. This bean post-processor adds an advisor to any bean that’s annotated with @Repository so that any platform-specific exceptions are caught and then rethrown as one of Spring’s unchecked data access exceptions.</li></ul><p><strong>Spring Cloud annotations</strong></p><p>And finally below are some of the basic spring cloud annotations that are used in cloud applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aopcd8pl0RHkLo2pi7So6A.png" /><figcaption><strong>Spring Cloud annotations</strong></figcaption></figure><p><strong>References</strong></p><ul><li><a href="https://spring.io/projects/spring-boot">https://spring.io/projects/spring-boot</a></li><li><a href="https://www.baeldung.com/spring-boot">https://www.baeldung.com/spring-boot</a></li><li><a href="https://dzone.com/articles/spring-boot-framework-tutorials">https://dzone.com/articles/spring-boot-framework-tutorials</a></li><li><a href="https://www.educba.com/what-is-spring-boot/">https://www.educba.com/what-is-spring-boot/</a></li><li><a href="https://www.javagists.com/spring-boot-cheatsheet">https://www.javagists.com/spring-boot-cheatsheet</a></li></ul><blockquote>***********Thank you for reading************ **********************************************</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fd44b1de853" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/basic-spring-spring-boot-annotations-6fd44b1de853">Basic Spring &amp; Spring Boot Annotations</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon DynamoDB Core Concepts]]></title>
            <link>https://medium.com/adessoturkey/amazon-dynamodb-core-concepts-a4890078c02f?source=rss-746c9c0b5f2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4890078c02f</guid>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[dynamodb]]></category>
            <dc:creator><![CDATA[Revda Uluışık]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 20:06:57 GMT</pubDate>
            <atom:updated>2021-06-28T11:46:38.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2rylHFpxiifiah5PqmEl-w.png" /></figure><p>This article is a short and brief introduction to Amazon’s NoSQL database where you can grasp a quick overview of the following topics:</p><ul><li><em>What is DynamoDB?</em></li><li><em>DynamoDB Core Concepts</em></li><li><em>DynamoDB API</em></li><li><em>Programming with DynamoDB</em></li></ul><h4><strong>What is DynamoDB?</strong></h4><p>DynamoDB is a fully managed NoSQL key/value and document database which is suited for workloads with any amount of data that require predictable read and write performance<strong> </strong>and automatic scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*xkGg_25zmexBquubhC1SgQ.png" /><figcaption><strong>Fig 1: Top features of DynamoDB</strong></figcaption></figure><ul><li><strong><em>Fully managed by AWS:</em> </strong>provided as-a-service so users would not need to maintain the database</li><li><strong><em>Scalable:</em> </strong>automatically provisions hardware on the backend, invisible to the user</li><li><strong><em>Fast &amp; consistent:</em></strong> supports predictive levels of provisioned throughput at relatively low latencies</li><li><strong><em>Durable and highly available:</em></strong> multiple availability zones for failures/disaster recovery</li><li><strong><em>Flexible</em></strong><em>:</em> makes it easy for users to get started and continuously evolve their database</li><li><strong><em>Low cost</em></strong><em>:</em> is affordable for users as they start and while growing</li></ul><h4><strong>DynamoDB Core Concepts</strong></h4><p>Tables, items, and attributes (see Fig 2) are the core building blocks of DynamoDB.</p><p>A <strong><em>table</em> </strong>is a grouping of data records. For example, you might have a Users table to store data about your users, and an Orders table to store data about your users’ orders. This concept is similar to a table in a relational database.</p><p>An <strong><em>item</em> </strong>is a single data record in a table. Each item in a table is uniquely identified by the stated primary key of the table. In your Users table, an item would be a particular User. An item is similar to a row in a relational database.</p><p><strong><em>Attributes</em> </strong>are pieces of data attached to a single item. This could be a simple Age attribute that stores the age of a user. An attribute is comparable to a column in a relational database.</p><p>**DynamoDB does not require attributes on items except for attributes that make up your primary key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*1TcbvYaGe9_1nYlkZyre6w.png" /><figcaption><strong>Fig 2: Building blocks for DynamoDB</strong></figcaption></figure><p><strong><em>Primary Key:</em></strong></p><p>Each item in a table is uniquely identified by a primary key. The primary key definition must be defined at the creation of the table, and the primary key must be provided when inserting a new item. There are 2 types of a primary key :</p><ul><li>Simple primary key: consists of a partition key</li><li>Composite primary key: consists of partition key and sort key</li></ul><p><strong><em>a-) Simple Primary Key:</em></strong></p><p>Using a simple primary key is similar to accessing rows in a SQL table by a primary key. One example would be a People table with a PersonID primary key. (see Fig 3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*-g311IqFtMn1OpF_Xv7Hgg.png" /><figcaption><strong>Fig 3: Simple Primary Key example</strong></figcaption></figure><ul><li>Uniquely identifies an item</li><li>Used as input to an internal hash function</li><li>No two items can have the same partition key</li></ul><p><strong><em>b-) Composite Primary Key:</em></strong></p><p>The composite primary key is more complex. With a composite primary key, you specify both a partition key and a sort key. The sort key is used to <em>sort</em> items with the same partition. One example could be a Music table for storing artists’ songs. The partition key would be the Artist, and the sort key would be the SongTitle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*cuwxZ7Gv3-eufgYd-GGYow.png" /><figcaption><strong>Fig 4: Composite Primary Key example</strong></figcaption></figure><ul><li>The first attribute is the partition key, the second attribute is the sort key</li><li>Uniquely identifies an item</li><li>Used as input to an internal hash function</li><li>It’s possible for two items to have the same partition key value( with different sort keys)</li><li>All items with the same partition key value are stored together, in sorted order by sort key value.</li><li>Provides additional flexibility when querying data</li></ul><p><strong><em>**Important notes**</em></strong></p><ul><li>The partition key of an item is also known as its hash attribute</li><li>The term hash attribute derives from the use of an internal hash function in DynamoDB that evenly distributes data items across partitions, based on their partition key values.</li><li>The sort key of an item is also known as its range attribute.</li><li>The term range attribute derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.</li><li>Data types allowed for primary key attributes: string, number, or binary.</li></ul><p><strong><em>Secondary Indexes</em></strong></p><p>The primary key uniquely identifies an item in a table, and you may make queries against the table using the primary key. However, sometimes you have additional access patterns that would be inefficient with your primary key. DynamoDB has secondary indexes to enable these additional access patterns. DynamoDB supports two kinds of secondary index:</p><ul><li>Global secondary index</li><li>Local secondary index</li></ul><p><strong><em>a-) Local Secondary Indexes</em></strong></p><p>The first kind of secondary index is a <strong>local secondary index</strong>. A local secondary index uses the same partition key as the underlying table but a different sort key and can only be created at table creation.</p><p>Let’s take our Music table example from the previous section and imagine you wanted to quickly access an artist’s songs in descending order of their Album Title names. You could add a local secondary index with a partition key of Artist and a sort key of AlbumTitle, allowing for efficient queries on an artist’s songs by album title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Tny06AG7p5qTNG0aQxKbnQ.png" /><figcaption><strong>Fig 5: Local Secondary Index</strong></figcaption></figure><p><strong><em>b-)Global Secondary Indexes</em></strong></p><p>The second kind of secondary index is a global secondary index. A global secondary index can define an entirely different primary key for a table. This could mean setting an index with just a partition key for a table with a composite primary key. It could also mean using completely different attributes to populate a partition key and sort key. It is important to note that a global secondary index can be created at any time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*U10SMQUeWgNA0FoCoHOIWg.png" /><figcaption><strong>Fig 6: Global Secondary Index</strong></figcaption></figure><p>The below table shows some basic differences between local and global secondary indexes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*sMtGk_sddpsaiRprqYsk9w.png" /><figcaption><strong><em>Fig 7: Global vs Local Secondary Indexes</em></strong></figcaption></figure><p><strong><em>Use Case for GSI</em></strong></p><p>Without a GSI the Music table shown below can be queried for <em>items by Artist (partition key)</em> and for <em>Artist and SongTitle (partition key and sort key)</em> but not for <em>Genre and AlbumTitle.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*q8krfGvjmXtc5t61-W1wVg.png" /><figcaption><strong><em>Fig 8: Music table and </em>GenreAlbumTitle GSI</strong></figcaption></figure><p>So let’s consider adding a GenreAlbumTitle GSI as in the figure above. Now the GenreAlbumTitle index can be queried to find</p><ul><li>All albums of a particular genre (for example, all Rock albums).</li><li>All albums within a particular genre having certain album titles (for example, all Country albums with titles that start with the letter H).</li></ul><p><strong><em>**Important Notes**</em></strong></p><ul><li>DynamoDB maintains indexes automatically. When you add, update, or delete an item in the base table, DynamoDB adds, updates, or deletes the corresponding item in any indexes that belong to that table.</li><li>When you create an index, you specify which attributes will be copied, or projected, from the base table to the index.</li><li>At a minimum, DynamoDB projects the key attributes from the base table into the index. This is the case with GenreAlbumTitle.</li></ul><p><strong>DynamoDB API</strong></p><p>To work with Amazon DynamoDB, an application must use a few simple API operations. We will talk about Basic API Control Operations and Classic API Operations (CRUD) in this section.</p><p><strong>Basic API Control Operations:</strong></p><ul><li><strong><em>CreateTable:</em></strong> Creates a new table. Optionally, you can create one or more secondary indexes</li><li><strong><em>DescribeTable:</em> </strong>Returns information about a table, such as its primary key schema, throughput settings, and index information.</li><li><strong><em>ListTables:</em></strong> Returns the names of all of your tables in a list.</li><li><strong><em>UpdateTable:</em></strong> Modifies the settings of a table or its indexes, creates or removes new indexes on a table, or modifies DynamoDB Streams settings for a table.</li><li><strong><em>DeleteTable:</em></strong> Removes a table and all of its dependent objects from DynamoDB.</li></ul><p><strong>Classic API Operations (CRUD):</strong></p><p><strong><em>1-Creating Data</em></strong></p><ul><li><strong><em>PutItem:</em></strong> Writes a single item to a table. You must specify the primary key attributes, but you don’t have to specify other attributes.</li><li><strong><em>BatchWriteItem:</em> </strong>Writes up to 25 items to a table. This is more efficient than calling PutItem multiple times because your application only needs a single network round trip to write the items. You can also use BatchWriteItem for deleting multiple items from one or more tables.</li></ul><p><strong><em>2- Reading Data</em></strong></p><ul><li><strong><em>GetItem:</em></strong> Retrieves a single item from a table. You must specify the primary key for the item that you want. You can retrieve the entire item or just a subset of its attributes.</li><li><strong><em>BatchGetItem:</em></strong> Retrieves up to 100 items from one or more tables. This is more efficient than calling GetItem multiple times because your application only needs a single network round trip to read the items.</li><li><strong><em>Query:</em></strong> Retrieves all items that have a specific partition key. You must specify the partition key value. You can retrieve entire items or just a subset of their attributes. Optionally, you can apply a condition to the sort key values so that you only retrieve a subset of the data that has the same partition key. You can use this operation on a table, provided that the table has both a partition key and a sort key. You can also use this operation on an index, provided that the index has both a partition key and a sort key.</li><li><strong><em>Scan:</em></strong> Retrieves all items in the specified table or index. You can retrieve entire items or just a subset of their attributes. Optionally, you can apply a filtering condition to return only the values that you are interested in and discard the rest.</li></ul><p><strong><em>3-Updating Data</em></strong></p><ul><li><strong><em>UpdateItem:</em></strong> Modifies one or more attributes in an item. You must specify the primary key for the item that you want to modify. You can add new attributes and modify or remove existing attributes with updateItem operation. You can also perform conditional updates so that the update is only successful when a user-defined condition is met.</li></ul><p><strong><em>4-Deleting Data</em></strong></p><ul><li><strong><em>DeleteItem:</em> </strong>Deletes a single item from a table. You must specify the primary key for the item that you want to delete.</li><li><strong><em>BatchWriteItem:</em></strong> Deletes up to 25 items from one or more tables. This is more efficient than calling DeleteItem multiple times because your application only needs a single network round trip to delete the items.</li></ul><p><strong>Programming with DynamoDB</strong></p><p>The following diagram provides a high-level overview of Amazon DynamoDB application programming using the AWS SDKs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*g_7RzuM17hns98WXvPKBfQ.png" /><figcaption><strong><em>Fig 9: </em>Amazon DynamoDB App. Programming</strong></figcaption></figure><ol><li>You write an application using an AWS SDK for your programming language.</li><li>Each AWS SDK provides one or more programmatic interfaces for working with DynamoDB. The specific interfaces available depend on which programming language and AWS SDK you use.</li><li>The AWS SDK constructs HTTP(S) requests for use with the low-level DynamoDB API.</li><li>The AWS SDK sends the request to the DynamoDB endpoint.</li><li>DynamoDB runs the request. If the request is successful, DynamoDB returns an HTTP 200 response code (OK). If the request is unsuccessful, DynamoDB returns an HTTP error code and an error message.</li><li>The AWS SDK processes the response and propagates it back to your application.</li></ol><p><strong><em>Higher-Level Programming Interfaces</em></strong></p><p>The AWS SDKs provide applications with low-level interfaces for working with Amazon DynamoDB.These client-side classes and methods correspond directly to the low-level DynamoDB API.</p><p>When it is needed to map complex data types to items with a low-level database interface, extra methods are required for reading or writing object data to database tables, and vice versa. The amount of extra code required for each combination of object type and database table can seem overwhelming.</p><p>This is where the higher-level interfaces for DynamoDB come into place letting you define the relationships between objects in your program and the database tables that store those objects’ data. After defining this mapping, you can call simple object methods such as save, load, or delete, and the underlying low-level DynamoDB operations are automatically invoked on your behalf and this allows you to write object-centric code, rather than database-centric code.</p><p><strong><em>DynamoDBMapper</em></strong></p><ul><li>Requires a definition of the relationship between items in a DynamoDB table and their corresponding object instances in your code.</li><li>The DynamoDBMapper class enables you to access your tables; perform various create, read, update, and delete (CRUD) operations; and run queries.</li><li>The DynamoDBMapper class does not allow you to create, update, or delete tables. To perform those tasks, use the low-level SDK for Java interface instead</li></ul><p><strong><em>Java Annotations for DynamoDB</em></strong></p><ul><li>DynamoDBAttribute</li><li>DynamoDBAutoGeneratedKey</li><li>DynamoDBDocument</li><li>DynamoDBHashKey</li><li>DynamoDBIgnore</li><li>DynamoDBIndexHashKey</li><li>DynamoDBIndexRangeKey</li><li>DynamoDBRangeKey</li><li>DynamoDBTable</li><li>DynamoDBTypeConverted</li><li>DynamoDBTyped</li><li>DynamoDBVersionAttribute</li></ul><blockquote><strong>***********Thank you for reading************ ******************************************</strong></blockquote><blockquote>Now that we have gone through some important basic concepts of DynamoDB stay tuned to dive deeper into these concepts in future blogs !!!</blockquote><h4><strong>References :</strong></h4><ul><li><a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html">https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html</a></li><li><a href="https://aws.amazon.com/dynamodb/">https://aws.amazon.com/dynamodb/</a></li><li><a href="https://www.dynamodbguide.com/key-concepts/">https://www.dynamodbguide.com/key-concepts/</a></li><li><em>SQL to NoSQL Best Practices with Amazon DynamoDB — AWS July 2016 Webinar Series</em> YouTube video, added by AWS Online Tech Talks [Online]. <br>Available at <a href="https://www.youtube.com/watch?v=RLxWobyd2Tc">https://www.youtube.com/watch?v=RLxWobyd2Tc</a> <br>[Accessed 18 June 2021].</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4890078c02f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adessoturkey/amazon-dynamodb-core-concepts-a4890078c02f">Amazon DynamoDB Core Concepts</a> was originally published in <a href="https://medium.com/adessoturkey">adessoTurkey</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>