質問編集履歴
8
mainの設定とのご指摘をして頂いた為、追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,6 +80,38 @@
|
|
80
80
|
|
81
81
|
```java
|
82
82
|
|
83
|
+
package com.example.demo;
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
import org.springframework.boot.SpringApplication;
|
88
|
+
|
89
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
@SpringBootApplication
|
94
|
+
|
95
|
+
public class PlayerSampleApplication {
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
public static void main(String[] args) {
|
100
|
+
|
101
|
+
SpringApplication.run(PlayerSampleApplication.class, args);
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
```java
|
114
|
+
|
83
115
|
package com.example.baseball.controller;
|
84
116
|
|
85
117
|
|
7
テキストの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので
|
29
|
+
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので文字数制限のため一部書かせて頂きました。)
|
30
30
|
|
31
31
|
> 2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
32
32
|
|
6
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので全部書かせて頂きました。)
|
30
30
|
|
31
|
-
2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
31
|
+
> 2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
32
32
|
|
33
33
|
2019-09-12 17:23:44.025 INFO 4246 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
|
34
34
|
|
@@ -58,6 +58,8 @@
|
|
58
58
|
|
59
59
|
2019-09-12 17:23:49.835 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 185 ms
|
60
60
|
|
61
|
+
|
62
|
+
|
61
63
|
長文になってしまい申し訳ありません。
|
62
64
|
|
63
65
|
|
5
質問の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -318,7 +318,81 @@
|
|
318
318
|
|
319
319
|
</body>
|
320
320
|
|
321
|
-
</html>
|
321
|
+
</html>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
```
|
326
|
+
|
327
|
+
```java
|
328
|
+
|
329
|
+
package com.example.baseball.service;
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
import java.util.List;
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
338
|
+
|
339
|
+
import org.springframework.stereotype.Service;
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
import com.example.baseball.domain.Player;
|
344
|
+
|
345
|
+
import com.example.baseball.repository.PlayerRepository;
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
@Service
|
350
|
+
|
351
|
+
public class PlayerService {
|
352
|
+
|
353
|
+
@Autowired
|
354
|
+
|
355
|
+
private PlayerRepository playerRepository;
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
public List<Player> findAll() {
|
360
|
+
|
361
|
+
return playerRepository.findAll();
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
public Player findOne(Long id) {
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
return playerRepository.findById(id).orElse(null);
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
public Player save(Player player) {
|
378
|
+
|
379
|
+
return playerRepository.save(player);
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
public void delete(Long id) {
|
386
|
+
|
387
|
+
playerRepository.deleteById(id);
|
388
|
+
|
389
|
+
}
|
390
|
+
|
391
|
+
}
|
392
|
+
|
393
|
+
```
|
394
|
+
|
395
|
+
```java
|
322
396
|
|
323
397
|
package com.example.baseball.repository;
|
324
398
|
|
@@ -344,182 +418,112 @@
|
|
344
418
|
|
345
419
|
```
|
346
420
|
|
347
|
-
|
348
|
-
|
349
421
|
```java
|
350
422
|
|
351
|
-
package com.example.baseball.
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
import java.
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
import
|
360
|
-
|
361
|
-
import
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
i
|
366
|
-
|
367
|
-
i
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
@
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
423
|
+
package com.example.baseball.domain;
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
import javax.persistence.Entity;
|
428
|
+
|
429
|
+
import javax.persistence.GeneratedValue;
|
430
|
+
|
431
|
+
import javax.persistence.GenerationType;
|
432
|
+
|
433
|
+
import javax.persistence.Id;
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
@Entity
|
438
|
+
|
439
|
+
public class Player {
|
440
|
+
|
441
|
+
@Id
|
442
|
+
|
443
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
444
|
+
|
445
|
+
private Long id;
|
446
|
+
|
447
|
+
private String name;
|
448
|
+
|
449
|
+
private Integer age;
|
450
|
+
|
451
|
+
private String team;
|
452
|
+
|
453
|
+
private String position;
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
public Long getId() {
|
458
|
+
|
459
|
+
return id;
|
460
|
+
|
461
|
+
}
|
462
|
+
|
463
|
+
public void setId(Long id) {
|
464
|
+
|
465
|
+
this.id = id;
|
466
|
+
|
467
|
+
}
|
468
|
+
|
469
|
+
public String getName() {
|
470
|
+
|
471
|
+
return name;
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
public void setName(String name) {
|
476
|
+
|
477
|
+
this.name = name;
|
478
|
+
|
479
|
+
}
|
480
|
+
|
481
|
+
public Integer getAge() {
|
482
|
+
|
483
|
+
return age;
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
public void setAge(Integer age) {
|
488
|
+
|
489
|
+
this.age = age;
|
490
|
+
|
491
|
+
}
|
492
|
+
|
493
|
+
public String getTeam() {
|
494
|
+
|
495
|
+
return team;
|
496
|
+
|
497
|
+
}
|
498
|
+
|
499
|
+
public void setTeam(String team) {
|
500
|
+
|
501
|
+
this.team = team;
|
502
|
+
|
503
|
+
}
|
504
|
+
|
505
|
+
public String getPosition() {
|
506
|
+
|
507
|
+
return position;
|
508
|
+
|
509
|
+
}
|
510
|
+
|
511
|
+
public void setPosition(String position) {
|
512
|
+
|
513
|
+
this.position = position;
|
514
|
+
|
515
|
+
}
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
@Override
|
520
|
+
|
521
|
+
public String toString() {
|
522
|
+
|
523
|
+
return "Player [id=" + id + ", name=" + name + ", age=" + age + ", team=" + team + ", position=" + position + "]";
|
524
|
+
|
525
|
+
}
|
412
526
|
|
413
527
|
}
|
414
528
|
|
415
529
|
```
|
416
|
-
|
417
|
-
```java
|
418
|
-
|
419
|
-
package com.example.baseball.domain;
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
import javax.persistence.Entity;
|
424
|
-
|
425
|
-
import javax.persistence.GeneratedValue;
|
426
|
-
|
427
|
-
import javax.persistence.GenerationType;
|
428
|
-
|
429
|
-
import javax.persistence.Id;
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
@Entity
|
434
|
-
|
435
|
-
public class Player {
|
436
|
-
|
437
|
-
@Id
|
438
|
-
|
439
|
-
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
440
|
-
|
441
|
-
private Long id;
|
442
|
-
|
443
|
-
private String name;
|
444
|
-
|
445
|
-
private Integer age;
|
446
|
-
|
447
|
-
private String team;
|
448
|
-
|
449
|
-
private String position;
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
public Long getId() {
|
454
|
-
|
455
|
-
return id;
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
public void setId(Long id) {
|
460
|
-
|
461
|
-
this.id = id;
|
462
|
-
|
463
|
-
}
|
464
|
-
|
465
|
-
public String getName() {
|
466
|
-
|
467
|
-
return name;
|
468
|
-
|
469
|
-
}
|
470
|
-
|
471
|
-
public void setName(String name) {
|
472
|
-
|
473
|
-
this.name = name;
|
474
|
-
|
475
|
-
}
|
476
|
-
|
477
|
-
public Integer getAge() {
|
478
|
-
|
479
|
-
return age;
|
480
|
-
|
481
|
-
}
|
482
|
-
|
483
|
-
public void setAge(Integer age) {
|
484
|
-
|
485
|
-
this.age = age;
|
486
|
-
|
487
|
-
}
|
488
|
-
|
489
|
-
public String getTeam() {
|
490
|
-
|
491
|
-
return team;
|
492
|
-
|
493
|
-
}
|
494
|
-
|
495
|
-
public void setTeam(String team) {
|
496
|
-
|
497
|
-
this.team = team;
|
498
|
-
|
499
|
-
}
|
500
|
-
|
501
|
-
public String getPosition() {
|
502
|
-
|
503
|
-
return position;
|
504
|
-
|
505
|
-
}
|
506
|
-
|
507
|
-
public void setPosition(String position) {
|
508
|
-
|
509
|
-
this.position = position;
|
510
|
-
|
511
|
-
}
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
@Override
|
516
|
-
|
517
|
-
public String toString() {
|
518
|
-
|
519
|
-
return "Player [id=" + id + ", name=" + name + ", age=" + age + ", team=" + team + ", position=" + position + "]";
|
520
|
-
|
521
|
-
}
|
522
|
-
|
523
|
-
}
|
524
|
-
|
525
|
-
```
|
4
ログの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,6 +26,42 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
+
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので全部書かせて頂きました。)
|
30
|
+
|
31
|
+
2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
32
|
+
|
33
|
+
2019-09-12 17:23:44.025 INFO 4246 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
|
34
|
+
|
35
|
+
2019-09-12 17:23:45.073 INFO 4246 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
|
36
|
+
|
37
|
+
2019-09-12 17:23:45.477 INFO 4246 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
|
38
|
+
|
39
|
+
2019-09-12 17:23:45.866 INFO 4246 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
|
40
|
+
|
41
|
+
2019-09-12 17:23:45.963 INFO 4246 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
|
42
|
+
|
43
|
+
2019-09-12 17:23:46.663 INFO 4246 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
|
44
|
+
|
45
|
+
2019-09-12 17:23:46.776 INFO 4246 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
|
46
|
+
|
47
|
+
2019-09-12 17:23:47.467 INFO 4246 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
|
48
|
+
|
49
|
+
2019-09-12 17:23:47.584 WARN 4246 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
50
|
+
|
51
|
+
2019-09-12 17:23:48.186 INFO 4246 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
|
52
|
+
|
53
|
+
2019-09-12 17:23:48.198 INFO 4246 --- [ restartedMain] c.example.demo.PlayerSampleApplication : Started PlayerSampleApplication in 11.952 seconds (JVM running for 15.298)
|
54
|
+
|
55
|
+
2019-09-12 17:23:49.645 INFO 4246 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
|
56
|
+
|
57
|
+
2019-09-12 17:23:49.650 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
|
58
|
+
|
59
|
+
2019-09-12 17:23:49.835 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 185 ms
|
60
|
+
|
61
|
+
長文になってしまい申し訳ありません。
|
62
|
+
|
63
|
+
|
64
|
+
|
29
65
|
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
30
66
|
|
31
67
|
おそらく最初のGetMapping("/players")の時点で処理の問題、もしくはhtmlでのtymeleafのエラーなのかもしれませんが間違いに気づくことができません。
|
3
エラーの出るタイミングの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
30
30
|
|
31
|
-
おそらく最初のGetMapping("/players")の時点で
|
31
|
+
おそらく最初のGetMapping("/players")の時点で処理の問題、もしくはhtmlでのtymeleafのエラーなのかもしれませんが間違いに気づくことができません。
|
32
32
|
|
33
33
|
JPAによる、自動でテーブルをcreate、レコードのinsert、selectができるかどうかを試しています。
|
34
34
|
|
2
エラーの出るタイミングの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
しかし、1系と2系(今2系です)の違いなのかどうもブラウザで表示ができません。
|
8
8
|
|
9
|
+
|
10
|
+
|
9
11
|
エラー内容としては、
|
10
12
|
|
11
13
|
Whitelabel Error Page
|
@@ -24,6 +26,10 @@
|
|
24
26
|
|
25
27
|
|
26
28
|
|
29
|
+
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
30
|
+
|
31
|
+
おそらく最初のGetMapping("/players")の時点でエラーが出てしまってるのだとは思っています。もしくはtymeleafのエラーなのかと考えてはいます。
|
32
|
+
|
27
33
|
JPAによる、自動でテーブルをcreate、レコードのinsert、selectができるかどうかを試しています。
|
28
34
|
|
29
35
|
Tomcatの起動も出来ている、ControllerのURLも間違っていないようですし、原因がわからず滞っています。
|
1
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
|
82
82
|
|
83
|
-
@GetMapping("/
|
83
|
+
@GetMapping("/players")
|
84
84
|
|
85
85
|
public String index(Model model) {
|
86
86
|
|