<?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 Musa Nabiyev on Medium]]></title>
        <description><![CDATA[Stories by Musa Nabiyev on Medium]]></description>
        <link>https://medium.com/@musanabiyev?source=rss-6c4613112f19------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xK0q_nuuWiHcHlItYrkeOA.png</url>
            <title>Stories by Musa Nabiyev on Medium</title>
            <link>https://medium.com/@musanabiyev?source=rss-6c4613112f19------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 21:04:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@musanabiyev/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[I am Musa Nabiyev, a startup founder actively engaged in the field of technology and innovation.]]></title>
            <link>https://medium.com/@musanabiyev/i-am-musa-nabiyev-a-startup-founder-actively-engaged-in-the-field-of-technology-and-innovation-739332c10d89?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/739332c10d89</guid>
            <category><![CDATA[mtech]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[company]]></category>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[founders]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Sun, 11 May 2025 00:47:26 GMT</pubDate>
            <atom:updated>2025-05-11T00:47:26.409Z</atom:updated>
            <content:encoded><![CDATA[<p>I am Musa Nabiyev, a startup founder actively engaged in the field of technology and innovation. My goal is to create scalable, useful, and impactful products by automating complex processes for global use. The projects I have developed are now used in over 50 countries and have contributed to reshaping industry standards across various sectors. I am continually striving to learn, improve, and solve real-world problems through technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=739332c10d89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Niyə Layihələr üçün Spring Boot Seçməliyik?]]></title>
            <link>https://medium.com/@musanabiyev/niy%C9%99-layih%C9%99l%C9%99r-%C3%BC%C3%A7%C3%BCn-spring-boot-se%C3%A7m%C9%99liyik-eb8abe9d49a2?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb8abe9d49a2</guid>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 17:41:08 GMT</pubDate>
            <atom:updated>2025-02-16T17:45:05.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*yOIWsydBhJfT48QSAglggw.png" /></figure><p><strong>Müasir texnologiya dünyasında sürət və effektivlik hər şeydir! Spring Boot bu ehtiyacı qarşılayaraq layihələrinizi daha sürətli inkişaf etdirmək və bazara tez çıxarmaq üçün ideal platformadır.</strong></p><p><strong>Spring Boot və Java-nın Üstünlükləri:</strong> Sürətli İnkişaf və Asan Konfiqurasiya: Avtomatik konfiqurasiya xüsusiyyəti ilə layihənizi sürətlə qurun. Annotasiyalarla lazımi tənzimləmələr avtomatik edilir.</p><p><strong>Güclü və Təhlükəsiz Platforma:</strong> Java-nın etibarlılığı və güclü təhlükəsizlik xüsusiyyətləri ilə təhlükəsiz tətbiqlər hazırlamaq daha asandır. Miqyaslana Bilən Arxitektura: Monolitdən mikroservislərə asan keçid edərək layihənizi genişləndirin və yeni funksionallıqlar əlavə edin.</p><p><strong>Böyük İcma və Dəstək:</strong> Geniş icma və güclü sənədləşmə sayəsində problemləri tez həll edin və yeni texnologiyaları sürətlə öyrənin.</p><p><strong>Sürətli İnkişafın Bizneslər və Startup-lar üçün Əhəmiyyəti:</strong> Müasir biznesdə sürətli olmaq vacibdir. Xüsusilə startup-lar üçün bazara tez çıxmaq və müştəri tələblərinə tez uyğunlaşmaq uğurun əsas şərtidir. Daha sürətli inkişaf edərək resurslarınızı səmərəli istifadə edin və rəqabətdə öndə olun.</p><h4><strong>Auto API Generator ilə Spring Boot-u Daha da Sürətləndirin!</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*V8KwoPo4xR5kLH0nWVcs2Q.jpeg" /></figure><p>Tək Spring Boot kifayət deyil! Layihənizi daha sürətli hazırlamaq və təkrarlanan kod yazmaqdan xilas olmaq üçün Auto API Generator ideal vasitədir!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*nyepriasdVjvkOfmeN8Jng.png" /></figure><p><strong>Multi-Class Seçimi ilə Sürətli API Yaradılması:</strong> Bir neçə sinfi seçərək, saniyələr içində minlərlə API yaradın. Əl ilə yazmağa vaxt itirmədən, layihəniz sürətlə hazır olsun! <br><strong>Hibernate və MyBatis Dəstəyi:</strong> <br>Həm Hibernate ilə @Entity annotasiyası, həm də MyBatis ilə POJO siniflərindən Mapper və XML fayllarını avtomatik yaradır. <br><strong>Liquibase ilə İnteqrasiya:</strong> <br>Verilənlər bazası dəyişikliklərini avtomatik izləyərək, YAML, SQL, XML və JSON formatlarında Liquibase skriptləri yaradır. <br><strong>File Upload API-ləri:</strong> <br>Image və PDF yükləmə əməliyyatları üçün xüsusi API-lər hazırlayaraq, fayl menecmentini asanlaşdırır. <br><strong>Clean Code və Best Practices:</strong> <br>Kodunuz oxunaqlı, təmiz və ən yaxşı proqramlaşdırma təcrübələrinə uyğun olur. <br><strong>Global Exception Handling:</strong> <br>Xətaları avtomatik idarə edərək daha stabil və təhlükəsiz tətbiq hazırlamağa kömək edir.</p><p><strong>Auto API Generator ilə Spring Boot layihələrinizi daha sürətli və effektiv şəkildə inkişaf etdirin! Bu gün yoxlayın və fərqi hiss edin!</strong></p><p><strong>Daha ətraflı məlumat videoda:<br></strong><a href="https://youtu.be/eY1YN3WKNE0">https://youtu.be/eY1YN3WKNE0</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb8abe9d49a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Insertion Sort Algorithm]]></title>
            <link>https://medium.com/@musanabiyev/insertion-sort-algorithm-78b3a25a130e?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/78b3a25a130e</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[training]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 11:55:38 GMT</pubDate>
            <atom:updated>2024-02-20T11:55:38.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mDJ7ZczYSIfdo_35HStWpg.png" /><figcaption><strong>Insertion Sort Algorithm in Java</strong></figcaption></figure><pre>public class InsertionSort {<br>    public static void insertionSort(int[] array) {<br>        int n = array.length;<br><br>        for (int i = 1; i &lt; n; i++) {<br>            int key = array[i];<br>            int j = i - 1;<br><br>            while (j &gt;= 0 &amp;&amp; array[j] &gt; key) {<br>                array[j + 1] = array[j];<br>                j--;<br>            }<br>            array[j + 1] = key;<br>        }<br>    }<br><br>    public static void main(String[] args) {<br>        int[] array = {64, 34, 25, 12, 22, 11, 90};<br>        insertionSort(array);<br>        System.out.print(&quot;Insertion Sort: &quot;);<br>        for (int num : array) {<br>            System.out.print(num + &quot; &quot;);<br>        }<br>    }<br>}</pre><p>Insertion sort is a sorting algorithm in which elements are moved one by one to the correct position.</p><p>public static void insertionSort(int[] array) {…} method takes an array of numbers as a parameter.<br> int n = array.length; The length of the input array is assigned to the variable n.</p><p>for (int i = 1; i &lt; n; i++) for goes from the second element of the array to the last element. int key = array[i]; The current element is assigned to the key variable.<br> int j = i — 1; The index j is set to the index of the last sorted element before the key element.<br> while (j &gt;= 0 &amp;&amp; array[j] &gt; key) the necessary operations are performed to place the key element in the appropriate place. This loop continues until it finds an array[j] element that is smaller than key and finds a suitable location.</p><p>array[j + 1] = key; the key element is placed in the appropriate place. These operations are repeated to place the next element in the appropriate place in the sorted section, and the array is sorted.</p><p>The time complexity of the Insertion Sort algorithm is O(n²), where “n” represents the length of the list. This complexity is used by two loops (the first for loop, the second while loop) to place the next element in the appropriate place. The first cycle runs n-1 times (n-1 times in a list with n elements), and the second cycle runs from the oldest to the considered element. This has an average complexity of O(n²). Insertion Sort can work more efficiently on small lists or when part of the list is already sorted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78b3a25a130e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java OCAexam question]]></title>
            <link>https://medium.com/@musanabiyev/java-ocaexam-question-aab1cb1bc791?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/aab1cb1bc791</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[oracle-certification]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 20:17:03 GMT</pubDate>
            <atom:updated>2024-01-29T22:26:32.644Z</atom:updated>
            <content:encoded><![CDATA[<h3>Java OCA exam question</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3nBBmc8Q2E2K3sEdmff9g.png" /></figure><pre>class Parent {<br><br>    Parent() {<br>        print();<br>    }<br><br>    void print() {<br>        System.out.println(&quot;Parent&quot;);<br>    }<br>}<br><br>class Child extends Parent {<br><br>    int i = 5;<br><br>    public static void main(String[] args) {<br>        Parent obj = new Child();<br>        obj.print();<br>    }<br><br>    void print() {<br>        System.out.println(i);<br>    }<br>}</pre><pre>what do you think the answer is?<br>a) Parent, 4<br>b) Parent, Parent<br>c) 0, 5<br>d) 5, 5</pre><ol><li>In the first line of the Main method, a reference to the Parent class is created, and at this time the constructor of the Child class is called (this type of writing is correct due to the feature of polymorphism).</li><li>If the Child class has a super class, the constructor of the super class must be called first, and in this example, the constructor of the Parent class is called.</li><li>The print() method is called in the constructor of the Parent class. Since the print() method is overridden in the Child class, the print() method in the Child class is executed, not the print() method in the Parent class;</li><li>In this step, the variable i is printed, and one of the most interesting parts of the work happens. The i variable is an instance variable of the Child class, and the values of the instance variables are assigned after the super constructor is executed. At this stage, the print() method has been called in the body of the super constructor, so the execution of the super constructor has not finished yet. That is why the variable i has not yet been assigned a value, so the default value (zero) of the variable i is printed.</li><li>The execution of the super constructor ends, and the value 5 is assigned to the variable i.</li><li>In the main method, the print() method is called over the obj reference. Although the obj reference belongs to the Parent class, the “actual object” belongs to the Child class. Therefore, the runtime checks whether the print() method is overridden in the Child class. In the Child class, the print() method is overridden, so that method is called and the value of i (5) is printed.</li></ol><h4><strong><em>correct answer</em></strong></h4><h4><strong><em>c) 0, 5</em></strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aab1cb1bc791" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Gateway]]></title>
            <link>https://medium.com/@musanabiyev/api-gateway-1a7f63bcde09?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a7f63bcde09</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Fri, 19 Jan 2024 00:18:10 GMT</pubDate>
            <atom:updated>2024-01-19T00:18:10.825Z</atom:updated>
            <content:encoded><![CDATA[<p>Clients do not access microservices directly. The API Gateway acts as an entry point for clients to route their requests to the appropriate microservices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7vVsOMcQ0tuXNnFT0Zb6A.png" /></figure><p>Advantages of using the API Gateway:</p><ol><li>All services can be updated without the knowledge of the client.</li><li>Services can use any messaging protocol to communicate with each other, independent of background clients.</li><li>API Gateway can also perform additional responsibilities such as security, authentication, authorization, and load balancing.</li></ol><p>In order to respond to requests from clients, microservices in the embedded architecture can perform their tasks by communicating with each other to fulfill the request.<br>You should note that the API Gateway should always be a highly available and performing component, as it is the entry point of the entire system.</p><p>All requests from clients first go through the API Gateway. It then forwards requests to the appropriate microservices. It can also convert Web protocols such as HTTP and WebSocket to various protocols used internally. According to its purpose, it can create a specific API for each type of client.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a7f63bcde09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encapsulating Data]]></title>
            <link>https://medium.com/@musanabiyev/encapsulating-data-279ab340348a?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/279ab340348a</guid>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 15:01:07 GMT</pubDate>
            <atom:updated>2023-11-23T15:01:07.257Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRB-WoJ95KgqFkbyoVTnNA.png" /></figure><p>Enkapsulyasiya OOP-nin əsas prinsiplərindən biridir və classı arzuolunmaz davranışlardan qorumaq məqsədi ilə istifadə olunur. Classın dəyişənləri private olur və həmin dəyişənlərə ancaq classın daxilində yaradılmış <em>public getter/setter</em> metodları vasitəsilə müraciət etmək mümkün olur. Məqsəd həmin dəyişənlərə doğru olmayan dəyərlər mənimsədilməsinin qarşısını almaqdır.</p><p><strong>Aşağıdakı — kod nümunəsi Java-da <br>Enkapsülasyona necə nail olacağınızı göstərir:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxa92DbidDGTKqoc7MFBZQ.png" /></figure><p>Enkapsulyasiya olunmuş classlar JavaBeans və həmin classın instance dəyişənləri isə property adlanır.</p><p><strong>JavaBeans üçün “naming conventions” qaydaları:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTIFK_qw1tj1d1K6FsvxhA.png" /></figure><p><strong>Boolean dəyərlər ilə getter metodlarda prefix kimi adətən “is” istifadə olunur, amma “get” də istifadə edilə bilər, bununla bağlı məhdudiyyət yoxdur. Nümunələrə baxaq:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiDTouoOXjfbdF_T3ClC-A.png" /></figure><p>Line 3, 4, 5 — adlandırma qaydalarına uyğundur (follow naming conventions); <br>Line 6, 7, 8 — adlandırma qaydalarına uyğun deyil (don’t follow naming conventions).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=279ab340348a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring MVC pattern]]></title>
            <link>https://medium.com/@musanabiyev/spring-mvc-pattern-d1291d2edec1?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1291d2edec1</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Sat, 20 May 2023 10:12:40 GMT</pubDate>
            <atom:updated>2023-05-20T10:12:40.024Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jli-pwWgjfiNq0lhAeN6AQ.png" /></figure><p>Spring framework MVC pattern istifadə edərək web proqramlarını inkişaf etdirmək üçün spring web mvc komponentini təklif edir ki, bunun sayəsində kodun modeli və view asılılıqlarını bir-birindən ayırır. client tərəfindən gələn ilk sorğu dispatcher servlet tərəfindən qarşılanır.<br>Spring’in təmin etdiyi İnfrastruktur ilə <em>@Controller,</em> <em>@RequestMapping</em> annotasiyalardan istifadə edərək dispatcher’in aldığı sorğuları müxtəlif handler metodlarına yönləndirməyə imkan verir.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1291d2edec1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLID Principles]]></title>
            <link>https://medium.com/@musanabiyev/solid-principles-bd226f3ec115?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd226f3ec115</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[solid]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Thu, 11 May 2023 10:41:29 GMT</pubDate>
            <atom:updated>2023-05-11T10:41:29.582Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7huAQ12u4-K40123RsyeGw.png" /></figure><h3>Single Responsibility</h3><p>Bu prinsip bir class-ın (obyektin) yalnız bir məsuliyyət daşımalı olduğunu bildirir .İnkişaf etdirdiyiniz class və ya method birdən çox məqsədə xidmət edirsə bu qaydaya ziddi</p><h3>Open / Closed</h3><p>Open: class genişləməyə açıq olmalıdır Closed: class-ın əsas xüsusiyyətlərini dəyişdirmək mümkün olmamalıdır.</p><h3>Liskov Substitution</h3><p>Alt class-lardan yaradılan obyektlər, super classlar obyektləri ilə əvəz edildikdə eyni davranışı nümayiş etdirməlidirlər. Əgər bu dəyişikliyə mane olan method, obyekt, dəyişən və s. varsa, dəyişiklik zamanı xəta baş verərsə, bu xətaya səbəb olan obyekt silinməli, və ya yeri dəyişdirilməlidir.</p><h3>Interface Segregation</h3><p>obyektlər interfeysi “implement” edərkən həmin interfeysin bütün metodlarını “override” etmək məcburiyyətindədir. Əgər bu interfeysi “implement” edən “class” oradakı hər hansı bir methodu istifadə etməyəcəksə, həmin metodu boş yerə “override” etməsi prinsipial olaraq düzgün deyil.</p><h3>Dependency Inversion</h3><p>konkretlərdən deyil, abstraktlardan asılı olmalıdır. bu prinsipin məğzi sıx əlaqələndirilmiş (“tightly coupled”) modullar arasına interfeyslər, “abstrakt class”-lar əlavə edərək birbaşa əlaqələri zəiflətməkdən ibarətdir (“loose coupling”).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd226f3ec115" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Framework]]></title>
            <link>https://medium.com/@musanabiyev/spring-framework-bc07ee8c9ba2?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc07ee8c9ba2</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-framework]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Mon, 08 May 2023 09:09:13 GMT</pubDate>
            <atom:updated>2023-05-08T09:09:13.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MaJ3eAWB41EgS3DZkSBCuA.png" /></figure><p><strong>Spring java proqram tərtibatçıları tərəfindən ən çox üstünlük verilən framework’dur</strong>, Rod Johnson tərəfindən yazılmış və ilk dəfə 2003-cü ilin iyununda Apache 2.0 lisenziyası altında buraxılmışdır.</p><p>Spring framework’un əsas məqsədi java obyekt əlaqələrinin idarə edilməsini developer’lər tərəfindən deyil, Tamamilə infrastruktur tərəfindən idarə olunmasını təmin etməkdir.</p><p>Spring framework kodun obyekt əlaqələrindən mümkün qədər müstəqil olması prinsipi əsasında hazırlanmışdır. Obyekt əlaqələrini idarə etmək üçün dependency injection və inversion of control prinsiplərini istifadə edir, Öz daxilində müəyyən edilmiş alt modullar sayəsində bizə çox güclü abstraksiya mühiti təmin edir.</p><p>Spring framework əsasında Spring Core modulunda IoC Konteyneri mövcuddur. IoC konteyneri, obyekt əlaqələrini idarə etmək üçün Spring’in istifadə etdiyi əsas komponentdir, Dependency Injection isə IoC’u həyata keçirmək üçün istifadə olunan üsuldur. IoC konteyneri tətbiq ayağa qalxdıqda obyektləri konfiqurasiya edir və obyektlər arasında əlaqələri qurur. Spring konteynerdə spring bean’lərimizi konfiqurasiya etmək üçün birdən çox üsul var xml konfiqurasiya faylında və ya siniflərə annotasiya əlavə etməklə edə bilərik.</p><p>Spring konteyneri tərəfindən idarə olunan əsas annotasiya <strong>@Component</strong> annotasiyasıdır və tətbiqin müxtəlif yerlərində istifadə etməli olduğumuz <strong>@Controller</strong>, <strong>@Repository</strong>, <strong>@Service</strong> annotasiyaları <strong>@Component</strong> annotasiyasının alt sinifləridir.</p><p>Spring tətbiqi ayağa qalxarkən istifadə edəcəyi bean’ləri tapıb bunların bir bir proxy obyektlərinin yaradılması lazımdır bizə lazım olan bean’ləri spring’ə müxtəlif yollarla təqdim edə bilərik, xml konfiqurasiya faylında bean təyin edə bilərik və ya spring’in bean’lərinin avtomatik olaraq skan etmək tapmaq xüsusiyyətindən istifadə edə bilərik. Bunun üçün <strong>@ComponentScan</strong> istifadə edə və bu annotasiya daxilində əsas paket strukturlarını təyin edə bilərik. Spring tərəfindən idarə olunan Spring bean obyektini əldə etmək istədikdə <strong>@Autowired</strong> annotasiyasından istifadə edirik. Spring bu annotasiyanı görəndə əvvəlcədən yaratdığı spring proxy obyektini Dependency Injection ilə <strong>@Autowired</strong> annotasiyasının altında yerləşən reference’a Inject edir. Hər dəfə <strong>@Autowired</strong> deyildikdə spring IoC konteyner bizə bir spring proxy obyekti qaytarır bu spring proxy obyektinin əvvəlcədən yaradılmış bir obyektimi qaytarmalı olduğunu yoxsa hər istəkdə yeni obyekt yaratmalıdırsa spring bean qeydində scop reference’na baxaraq qərar verilir. Məsələn, bean scope qeydimiz singleton’dursa hər həmin sinifin obyekti application ayağda olduğu müddətdə yalnız bir dəfə yaranacaq. scop qeydimiz prototype’dırsa IoC konteynerindən hər dəfə bean tələb etdikdə bizə yeni bean obyekti yaradır və onu geri qaytarır.</p><p>Spring framework default jdbc hibernate jpa template’ləri ilə, tərtibatçını verilənlər bazası ilə işləyərkən həll etməli olduğu bir çox problemlərdən, məsələn exception handling, əlaqənin qurulması, transaction idarə edilməsi kimi həll etməli olduğu bir çox problemlərdən xilas edir. transaction’nı idarə etmək üçün<strong> @Transactional</strong> annotasiyasından istifadə olunur bu annotasiyanı əlavə etdikdən sonra verilənlər bazası əlaqə yaratmaq, transaction başlanması və transaction metodumuz başa çatdıqda, bu transaction’ın commit etmək və ya rollback edilməsi spring arxa planda həll edir. Spring transaction propagation idarə edilməsi üçün <strong>@Transactional</strong> annotasiyası içərisinə propagation parametrini götürür default olaraq bu required’dir yəni <strong>@Transactional</strong> annotasiyasını ehtiva edən metod işlədikdə mövcud transaction varsa, yeni transaction açmadan bu transaction-dan istifadə edir, transaction yoxdursa, yeni transaction açır.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc07ee8c9ba2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DTO(Data Transfer Object)]]></title>
            <link>https://medium.com/@musanabiyev/dto-a0a423c0fbaa?source=rss-6c4613112f19------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0a423c0fbaa</guid>
            <category><![CDATA[dto]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Musa Nabiyev]]></dc:creator>
            <pubDate>Sat, 06 May 2023 08:37:55 GMT</pubDate>
            <atom:updated>2023-05-06T09:00:53.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4bIQ4fTkBKayHr7wQ-Imbg.png" /></figure><p><strong>DTO proseslər arasında məlumat daşıyan obyektlərdir.</strong></p><p>Biz entity’lərimizi API vasitəsilə bir başa xarici dünyaya açmaq istəmirik çünki bu təhlükəsizlik zəifliyi yarada və ya entity obyektini controller və service səviyyəsində istifadə etmək bəzi xətalara səbəb ola bilər. Bundan əlavə entity siniflərimizdəki bəzi field’lər daxili modelimizə və ya verilənlər bazamıza aid ola bilər, ona görə də client’ə lazımsız sahələri göndərməməliyik. Həmçinin gələcəkdə modelimizə başqa bir field əlavə etsək, client olan bütün proqramlarda dəyişiklik etməli olacağıq bu cür səbəblərdən bizə DTO adlandırdığımız obyekt lazımdır.</p><p>DTO nümunəsini tətbiq edək</p><pre> public class UserRestController {<br><br>    private final UserService userService;<br><br>    @PostMapping(value = &quot;/sign-up&quot;)<br>    public ResponseEntity&lt;UserDTO&gt; createUser(<br>            @Valid @RequestBody CreateUserRequestDTOcreateUserRequestDTO) {<br><br>        return ResponseEntity.ok(userService.createUser(createUserRequestDTO));<br>    }<br>  }</pre><p>UserController sinifində createUser metodumuz var parametr olaraq CreateUserRequestDTO adlı sinif qəbul edir geriyə isə UserDTO sinifi qaytarır</p><pre>public class CreateUserRequestDTO {<br>   private String firstname;<br>   private String lastname;<br>   private String username;<br>   private String email;<br>   private String phone;<br>   private String password;<br>}</pre><pre>public class UserDTO {<br>   private Long id;<br>   private String firstname;<br>   private String lastname;<br>   private String username;<br>   private String email;<br>   private String phone;<br>}</pre><p>Entity sinifində olan məlumatları UserDTO sinifinə çevirmək üçün UserDTOConverter sinifi düzəldirik</p><pre>public class UserDTOConverter {<br><br>   public UserDTO convert(User from){<br>      return new UserDTO(<br>              from.getId(),from.getFirstname(),<br>              from.getLastname(),from.getUsername(),<br>              from.getEmail(),from.getPhone());<br>   }<br><br>   public List&lt;UserDTO&gt; convert(List&lt;User&gt; fromList){<br>      return fromList.stream().map(from -&gt; new UserDTO(<br>                from.getId(),from.getFirstname(),<br>                from.getLastname(),from.getUsername(),<br>                from.getEmail(),from.getPhone()))<br>             .collect(Collectors.toList());<br>   }<br>}</pre><p>sonda UserService sinifində CreateUserRequestDTO sinifindən aldığımız məlumatları User (entity) sinifinə set edərək verilənlər bazasına əlavə edirik geriyə qayıdan məlumatları isə UserDTOConverter sinifinin köməyi ilə User sinifinin məlumatlarını UserDTO sinifinə çevirərək geri qaytarırıq</p><pre>public class UserService {<br><br>   private final UserRepository userRepository;<br>   private final UserDTOConverter userDTOConverter;<br>   private final BCryptPasswordEncoder cryptPasswordEncoder;<br><br>  public UserDTO createUser(CreateUserRequestDTO createUserRequestDTO) {<br><br>    User user =<br>          User.builder()<br>                  .firstname(createUserRequestDTO.getFirstname())<br>                  .lastname(createUserRequestDTO.getLastname())<br>                  .username(createUserRequestDTO.getUsername())<br>                  .password(cryptPasswordEncoder<br>                       .encode(createUserRequestDTO.getPassword()))<br>                  .phoneNumber(createUserRequestDTO.getPhone())<br>                  .creationDate(LocalDateTime.now())<br>                  .build();<br><br>    return userDTOConverter.convert(userRepository.save(user));<br>    <br> }                <br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0a423c0fbaa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>