Spring Boot REST API Anti-Patterns and Best Practices

Sdílet
Vložit
  • čas přidán 15. 07. 2024
  • #sivalabs #spring #springboot #intellij #productivity #java #testing #junit #junit5 #maven #jpa #hibernate #unittesting
    In this video, I will explain what are some of the common anti-patterns used in Spring Boot REST API development and how to fix them by following best practices.
    Timestamps
    00:00:00 Introduction
    00:03:10 Existing REST API walk-through
    00:06:42 Not following REST conventions
    00:18:57 Using Field Injection
    00:28:42 Not using pagination
    00:36:00 Not using request-specific payload bindings
    00:45:42 Using JPA DDL auto-generation
    00:53:18 Misusing Spring Data JPA derived-query method names
    00:57:23 Loading entire entities and using only a small subset of fields
    01:03:00 Using JPA that results in N+1 Select problems
    01:09:36 Not implementing proper Exception Handling
    01:15:48 Using @SpringBootTest for testing slices (controller, repository)
    01:21:35 Testing with in-memory database
    01:29:01 Not using proper package structure
    References
    =============================================
    ⭐ Source Code: github.com/sivaprasadreddy/si...
    ⭐ Spring Boot Tutorials: www.sivalabs.in/spring-boot-t...
    ⭐ Tomato Architecture - A Pragmatic Approach to Software Design: www.sivalabs.in/tomato-archit...
    ⭐ Modular Monoliths • Simon Brown: • Modular Monoliths • Si...
    Connect with Me
    =============================================
    Blog: www.sivalabs.in
    CZcams: / sivalabs
    Twitter: / sivalabs
    GitHub: github.com/sivaprasadreddy
    LinkedIn: / ksivaprasadreddy
    Popular Series Playlists
    =============================================
    🚀 🎬 Spring Boot Tips Series Playlist • Spring Boot Tips
    🚀 🎬 Spring Boot + Kubernetes Tutorial Series Playlist • Spring Boot + Kubernet...
    🚀 🎬 Spring Boot - The Missing Guide Series Playlist • Spring Boot - The Miss...
    🚀 🎬 Integration Testing with Testcontainers • Integration Testing wi...
    🚀 🎬 Java Testing Made Easy Playlist • Java Testing Made Easy...
    ⭐ Tags ⭐
    best spring tutorials, best spring boot tutorials, how to learn spring boot, mastering spring boot, complete java testing course, java testing best practices, how to build spring boot rest API, spring cloud tutorials, spring boot docker tutorial, spring boot Kubernetes tutorial, how to become proficient in java, how to learn spring boot quickly, how to learn spring boot in-depth
  • Věda a technologie

Komentáře • 9

  • @ajitnayak9t99
    @ajitnayak9t99 Před 3 měsíci

    Useful tutorial things!

  • @Mr3dvinas
    @Mr3dvinas Před 3 měsíci

    Amazing thank you brother !!

  • @momedalhouma14
    @momedalhouma14 Před 3 měsíci

    Thank you si a for the wonderful effort

  • @mohamedshaker7528
    @mohamedshaker7528 Před 11 dny

    I've an enhancement on the pagination request you could use the
    one based index instead of subtracting to be zero by just providing the property on the application propertise
    spring:
    data:
    web:
    pageable:
    one-indexed-parameters: true

  • @zickzack987
    @zickzack987 Před 29 dny

    Only the first topic covers "Rest". Url naming patterns and certain status codes are not mandatory to be restful. Only a uniform interface.

  • @nagkumar
    @nagkumar Před 3 měsíci

    production-ready is also highly claimed too --> hence reworded as is the DONE #productEconomy scale ready

  • @dishaarya3459
    @dishaarya3459 Před 3 měsíci

    Sir, kindly make the tutorial over Servlet JSP JDBC so that our prerequisites are clear.

  • @universal4334
    @universal4334 Před 2 měsíci

    Can i do a post for getting things if i have a nested hierarchy like a category inside multiple categories, then brand inside multiple brands, then size where I'll be having lot of sizes. So if i want to pass multiple categories, brands, and sizes to get info

    • @sivalabs
      @sivalabs  Před 2 měsíci

      REST principles are more of guidelines than rules. Sometimes we have to use POST for getting the information due to the payload limitation of GET request. For example Elasticsearch uses POST for fetching matching documents.