0
1

More than 3 years have passed since last update.

Spring Tool Suite (STS)とGradleとSpring BootでWebアプリ起動

Posted at

1.STSでプロジェクト作成

1)ファイルから「新規」->「Spring スターター・プロジェクト」を選択
1.png
2)型に「Gradle」を選択し「次へ」ボタンを押下
2.png
3)「Web」->「Spring Web」にチェックを入れ、「次へ」ボタンを押下
3.png
4)そのまま「完了」ボタンを押下
4.png
5)プロジェクト作成完了
5.png

2.作成したプロジェクトのプログラムを編集

1)「application.properties」に「server.port=ポート番号」を追加
6.png
2)「com.example.demo」パッケージに「DemoController.java」ファイルを追加
7.png
3)「src/main/resources/templates」フォルダに「index.html」ファイルを追加
8.png

3.作成したプロジェクトを実行

1)「demo」プロジェクトを右クリックし、「実行」->「Spring Boot アプリケーション」を選択
9.png
2)アプリケーション起動を確認(Springの文字が表示される)
10.png
3)WebブラウザでURLに「localhost:(ポート番号)」を入力で画面が表示される
  http://localhost:8080/
11.png
4)アプリケーションの停止は「■」ボタンを押下
12.png

0
1
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
1