0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Basic 1. Spring Tools Suite インストール

Last updated at Posted at 2020-04-27

1. こちらからEclipseをinstall

2. 動作確認

2.1. プロジェクトを作成する

New -> Projectの「Spring Boot」を開き、「Spring Starter Project」を選択する

スクリーンショット 2020-04-27 18.41.22.png スクリーンショット 2020-04-27 18.42.29.png

NameはHello
Gradle 3.X
Java 11

スクリーンショット 2020-04-27 18.47.57.png

Spring Webを検索
Spring Webを選択

スクリーンショット 2020-04-27 18.49.05.png

Finish

2.2. hello worldのファイルに追記

src/main/java/com/example/hello/HelloApplication.java

src/main/java/com/example/hello/HelloApplication.java
@SpringBootApplication

の下に

src/main/java/com/example/hello/HelloApplication.java
@RestController

src/main/java/com/example/hello/HelloApplication.java
public static void main(String[] args) {
	SpringApplication.run(Hello2Application.class, args);	
}

の下に

src/main/java/com/example/hello/HelloApplication.java
@GetMapping("/hello")
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format("Hello %s!", name);
}

を追加する。

  • Command + Shift + O import文の補完
  • Command + Shift + F コードの整形

2.3. ブラウザで表示

src/main/java/com/example/hello/HelloApplication.javaを右クリックして
Run As -> Spring Boot Appとして起動する。

スクリーンショット 2020-04-28 10.53.02.png

URLにブラウザでアクセス
http://localhost:8080/hello

スクリーンショット 2020-04-27 18.52.36.png

hello world!と表示されればインストールは終了。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?