Spring Boot 4 Complete Guide · レッスン

最初のアプリケーションを作成する

Spring Initializrを使って基本的な「Hello World」アプリケーションを構築し、プロジェクト構成を確認します。

レッスン 2/411 ステップ

「最初のアプリケーションを作成する」はCoddyKit上の無料Spring Boot 4 Complete Guideレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSpring Boot 4 Complete Guide学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Spring Boot 4 Complete Guideコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Your First Spring Boot App

Time to build your first app! You'll use Spring Initializr to scaffold a project, then create a simple Hello World and explore its structure.

Meet Spring Initializr

Spring Initializr is a project wizard for Spring. Pick your build tool, language, and version, and it generates the boilerplate so you don't have to.

Launching Initializr

Open Spring Initializr at start.spring.io in your browser. IntelliJ and Eclipse also bundle it right into their New Project dialog.

Project Details

In Initializr you set the basics: build tool (Maven), language (Java), Spring Boot version, plus Group and Artifact to name your project and package.

Core Dependencies

Dependencies are the libraries your app needs. Add Spring Web — it brings everything for web apps, including an embedded Tomcat. Search and add it now.

Generate & Open

Hit Generate to download a zip, unzip it, and import it into your IDE. It'll recognize the Maven project and set things up automatically.

Exploring Your Project

Know your layout: src/main/java for code, src/main/resources for config and assets, src/test/java for tests, and pom.xml for dependencies and build settings.

The Core Class

Your main class is the entry point. It carries @SpringBootApplication and a standard main method that calls SpringApplication.run() to boot the app.

Run Your First App!

Let's print a message at startup using a CommandLineRunner — a component that runs your code right after the application context loads.

package com.example.myfirstapp;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class MyfirstappApplication {

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

    @Bean
    public CommandLineRunner run(String... args) throws Exception {
        return args -> System.out.println("Hello CoddyKit!");
    }
}

Project Structure Check

Which of these files/folders is typically found in a newly generated Spring Boot project and is used to define its dependencies?

Recap: Your First App

Done! You scaffolded a project with Spring Initializr, added Spring Web, explored the structure, and printed Hello World via a CommandLineRunner. Next: auto-configuration in depth.

無料で開始

AI チューターと学ぶ Java — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
21
レッスン
84

よくある質問

「最初のアプリケーションを作成する」レッスンは無料ですか?

はい。「最初のアプリケーションを作成する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Spring Boot 4 Complete Guideコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Spring Boot 4 Complete Guideコースには全4レッスンが含まれています。

「最初のアプリケーションを作成する」で何を学びますか?

Spring Initializrを使って基本的な「Hello World」アプリケーションを構築し、プロジェクト構成を確認します。 ブラウザで直接実行するハンズオンコードでSpring Boot 4 Complete Guideを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Spring Boot 4 Complete Guideを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのSpring Boot 4 Complete Guideは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。

「最初のアプリケーションを作成する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このSpring Boot 4 Complete Guideレッスンでコードを書いて実行できますか?

はい。すべてのSpring Boot 4 Complete Guideレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Spring Boot 4入門
  2. 最初のアプリケーションを作成する
  3. Spring Bootの自動設定
  4. Spring Bootプロジェクト構成の理解
← Spring Boot 4 Complete Guideに戻る