LoginSignup
0
1

More than 3 years have passed since last update.

javaでwebApi備忘録

Posted at

事前準備

・エクリプスの最新版

①eclipsのインストール方法
https://snome.jp/framework/springboot-install-win/
SpringBootの使用の前までで完了
ワークスペースのなぞ?
Eclipse はワークスペースとして指定されてディレクトリに “.metadata” という隠しディレクトリを作るので、これを検索します。
②Javaコンパイラの設定
特に設定しなくてもOK
③WEBAPIの作成方法
 サンプルを元にマーベンのPOMを変更
 https://codezine.jp/article/detail/11380?p=3
 
 ④Java Spring Boot JSONの送信と受信のサンプル
 https://itsakura.com/java-springboot-json#s7
ハローワールドの出し方
https://qiita.com/kuro227/items/d7da647e9f3be78a5f92
アクセスするURL
http://localhost:8081/hello/
リファレンスAPI スプリング
https://spring.pleiades.io/guides/tutorials/bookmarks/
マーベンのPOM
https://mvnrepository.com/search?q=javax.validation
spring boot で web api サーバを作る
https://qiita.com/kuro227/items/d7da647e9f3be78a5f92
修正点
・HelloWorldController.java
・Syain.java

ファイル(test.html)
```java

でマッピング
@RequestMapping(method = RequestMethod.GET)
public String getHello() {
return "hello world!";
}
file:///C:/Users/shimizu/Desktop/test2.html
でここにマッピングされる
@RequestMapping(value = "/index",method = {RequestMethod.POST})
@ResponseBody
public Syain output1(
@RequestBody Syain syain) {
System.out.println(syain.getBangou());
System.out.println(syain.getName());
return syain;
}

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