LoginSignup
0
0

IntelliJでSpring Bootを実行

Last updated at Posted at 2024-02-07

IntelliJのインストール

Intellijには無料版と有料版がありますが、今回は無料版IntelliJ IDEA Community Editionを使用します。
https://www.jetbrains.com/idea/download/?section=windows#section=windows
image.png

SpringBootプロジェクトの作成

https://start.spring.io/
image.png

IntelliJでプロジェクトを開く

image.png

HelloWorldのサンプル作成

package com.example.demo.controller;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;

@RestController
public class HelloController {

  // 「/hello」へアクセスがあった場合
  @GetMapping("/hello")
  public String helloWorld() {
    // 文字列を返す
    return "Hello Spring-Boot World!!";
  }

}

image.png

build

image.png

bootRun

image.png

HelloWorldの確認

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0