GraphQL APIs with Spring Boot · درس

إعداد Spring Boot لـ GraphQL

هيّئ تطبيق Spring Boot جديدًا وادمج التبعيات اللازمة لتطوير GraphQL API.

الدرس 2 من 411 خطوة

إعداد Spring Boot لـ GraphQL درس مجاني في GraphQL APIs with Spring Boot على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في GraphQL APIs with Spring Boot، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة GraphQL APIs with Spring Boot 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Get Ready for GraphQL!

Time to build a GraphQL API with Spring Boot. You’ll configure a project and add the GraphQL dependencies that bring these two together.

Create Your First Project

The fastest start is Spring Initializr at start.spring.io: pick Maven or Gradle, Java, the latest Spring Boot, and add the Spring Web dependency.

Initial Project Structure

Unzipped, you get a standard layout. The *Application.java class holds the main method that boots your app — run it to confirm setup before adding GraphQL.

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {
  public static void main(String[] args) {
    SpringApplication.run(DemoApplication.class, args);
  }
}

Bring in GraphQL Power

Add GraphQL power with one dependency: spring-boot-starter-graphql. It bundles the engine, auto-configures it, and even gives you a GraphiQL UI.

Maven: Adding the Starter

On Maven, drop spring-boot-starter-graphql into the <dependencies> block of your pom.xml and Maven pulls in every GraphQL library.

<dependencies>
  <!-- Existing dependencies like spring-boot-starter-web -->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-graphql</artifactId>
  </dependency>
</dependencies>

Gradle: Adding the Starter

On Gradle, add the same spring-boot-starter-graphql dependency to your build.gradle using the implementation configuration.

dependencies {
  // Existing dependencies like spring-boot-starter-web
  implementation 'org.springframework.boot:spring-boot-starter-graphql'
}

Project Layout for GraphQL

Spring Boot auto-discovers your schema in src/main/resources/graphql. Create that folder and an empty schema.graphqls — your API’s contract.

Running Your GraphQL App

Run the app from your IDE, or with ./mvnw spring-boot:run / ./gradlew bootRun. Watch for “Started DemoApplication” and Tomcat on port 8080.

Verify GraphQL Endpoint

The starter auto-configures a /graphql endpoint plus a GraphiQL UI. Open localhost:8080/graphiql — if it loads, your setup works.

Check Your Setup Knowledge

You've learned how to set up a basic Spring Boot project and integrate GraphQL dependencies. Let's quickly review what you need to do to get started.

Setup Complete! What's Next?

Setup done! You used Spring Initializr, added the GraphQL starter, and prepped your schema file. Next, design your first schema in SDL.

البدء مجانًا

تعلم GraphQL APIs with Spring Boot مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
12
الدروس
48

الأسئلة الشائعة

هل درس «إعداد Spring Boot لـ GraphQL» مجاني؟

نعم — نص درس «إعداد Spring Boot لـ GraphQL» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة GraphQL APIs with Spring Boot، انتقل إلى CoddyKit PRO. تتضمن دورة GraphQL APIs with Spring Boot 4 دروس في المجموع.

ماذا ستتعلم في «إعداد Spring Boot لـ GraphQL»؟

هيّئ تطبيق Spring Boot جديدًا وادمج التبعيات اللازمة لتطوير GraphQL API. تتمرن على GraphQL APIs with Spring Boot مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ GraphQL APIs with Spring Boot؟

لا تُشترط خبرة سابقة. GraphQL APIs with Spring Boot على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «إعداد Spring Boot لـ GraphQL»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس GraphQL APIs with Spring Boot هذا؟

نعم. كل درس في GraphQL APIs with Spring Boot يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. ما المقصود بـ GraphQL؟
  2. إعداد Spring Boot لـ GraphQL
  3. تصميم أول مخطط GraphQL لك
  4. GraphQL أم REST: اختيار النهج المناسب
← العودة إلى GraphQL APIs with Spring Boot