IntelliJとは
IntelliJ IDEA (インテリジェイ アイディア) は、チェコに本社を置くJetBrains社が開発した、Javaなど数多くのプログラミング言語に対応した統合開発環境である。
https://www.jetbrains.com/ja-jp/idea/
https://ja.wikipedia.org/wiki/IntelliJ_IDEA
IntelliJのダウンロード
プロジェクト作成
Spring Initializrでプロジェクトのひな型を作成します。
各種設定は初期設定のまま、DependenciesにてSpring Webを選択します。
「Generate」ボタンをクリックします。
Projectのインポート
解凍したdemoフォルダにあるpom.xmlを右クリックします。
「プログラムから開く」->「別のプログラムを選択」->IntelliJを選択します。
IntelliJは自動的にdemoプロジェクトを開きます。
Demo用Javaファイルを編集
demoApplication.javaのファイルを編集します。
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
@RequestMapping("/helloworld")
String index(){
return "Hello World!";
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
src配下のdemoApplication.javaを右クリックします。
Run DemoApplication mainを選択します。
実行が完了まで待ちます。
デモサイトへアクセスします。
http://localhost:8080/helloworld にアクセスすると、下記の画面が表示されます。
次回
IntelliJで簡単なREST APIを作ります。