質問編集履歴
8
mainの設定とのご指摘をして頂いた為、追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -39,6 +39,22 @@
|
|
39
39
|
|
40
40
|
よろしくお願いします。
|
41
41
|
```java
|
42
|
+
package com.example.demo;
|
43
|
+
|
44
|
+
import org.springframework.boot.SpringApplication;
|
45
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
46
|
+
|
47
|
+
@SpringBootApplication
|
48
|
+
public class PlayerSampleApplication {
|
49
|
+
|
50
|
+
public static void main(String[] args) {
|
51
|
+
SpringApplication.run(PlayerSampleApplication.class, args);
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
55
|
+
|
56
|
+
```
|
57
|
+
```java
|
42
58
|
package com.example.baseball.controller;
|
43
59
|
|
44
60
|
import java.util.List;
|
7
テキストの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
No message available
|
13
13
|
になります。
|
14
14
|
|
15
|
-
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので
|
15
|
+
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので文字数制限のため一部書かせて頂きました。)
|
16
16
|
> 2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
17
17
|
2019-09-12 17:23:44.025 INFO 4246 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
|
18
18
|
2019-09-12 17:23:45.073 INFO 4246 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
|
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
になります。
|
14
14
|
|
15
15
|
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので全部書かせて頂きました。)
|
16
|
-
2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
16
|
+
> 2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
17
17
|
2019-09-12 17:23:44.025 INFO 4246 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
|
18
18
|
2019-09-12 17:23:45.073 INFO 4246 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
|
19
19
|
2019-09-12 17:23:45.477 INFO 4246 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
|
@@ -28,6 +28,7 @@
|
|
28
28
|
2019-09-12 17:23:49.645 INFO 4246 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
|
29
29
|
2019-09-12 17:23:49.650 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
|
30
30
|
2019-09-12 17:23:49.835 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 185 ms
|
31
|
+
|
31
32
|
長文になってしまい申し訳ありません。
|
32
33
|
|
33
34
|
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
5
質問の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -158,20 +158,9 @@
|
|
158
158
|
<a class="btn btn-default" href="/players/new">新規作成</a>
|
159
159
|
</div>
|
160
160
|
</body>
|
161
|
-
</html>
|
161
|
+
</html>
|
162
|
-
package com.example.baseball.repository;
|
163
162
|
|
164
|
-
import org.springframework.data.jpa.repository.JpaRepository;
|
165
|
-
import org.springframework.stereotype.Repository;
|
166
|
-
|
167
|
-
import com.example.baseball.domain.Player;
|
168
|
-
|
169
|
-
@Repository
|
170
|
-
public interface PlayerRepository extends JpaRepository<Player, Long> {
|
171
|
-
|
172
|
-
}
|
173
163
|
```
|
174
|
-
|
175
164
|
```java
|
176
165
|
package com.example.baseball.service;
|
177
166
|
|
@@ -207,6 +196,19 @@
|
|
207
196
|
}
|
208
197
|
```
|
209
198
|
```java
|
199
|
+
package com.example.baseball.repository;
|
200
|
+
|
201
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
202
|
+
import org.springframework.stereotype.Repository;
|
203
|
+
|
204
|
+
import com.example.baseball.domain.Player;
|
205
|
+
|
206
|
+
@Repository
|
207
|
+
public interface PlayerRepository extends JpaRepository<Player, Long> {
|
208
|
+
|
209
|
+
}
|
210
|
+
```
|
211
|
+
```java
|
210
212
|
package com.example.baseball.domain;
|
211
213
|
|
212
214
|
import javax.persistence.Entity;
|
4
ログの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,6 +12,24 @@
|
|
12
12
|
No message available
|
13
13
|
になります。
|
14
14
|
|
15
|
+
また、起動時のログが以下の文章になります。(勉強不足のためマッピング情報がどれかわからなかったので全部書かせて頂きました。)
|
16
|
+
2019-09-12 17:23:44.013 INFO 4246 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
|
17
|
+
2019-09-12 17:23:44.025 INFO 4246 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
|
18
|
+
2019-09-12 17:23:45.073 INFO 4246 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
|
19
|
+
2019-09-12 17:23:45.477 INFO 4246 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
|
20
|
+
2019-09-12 17:23:45.866 INFO 4246 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
|
21
|
+
2019-09-12 17:23:45.963 INFO 4246 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
|
22
|
+
2019-09-12 17:23:46.663 INFO 4246 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
|
23
|
+
2019-09-12 17:23:46.776 INFO 4246 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
|
24
|
+
2019-09-12 17:23:47.467 INFO 4246 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
|
25
|
+
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
|
26
|
+
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 ''
|
27
|
+
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)
|
28
|
+
2019-09-12 17:23:49.645 INFO 4246 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
|
29
|
+
2019-09-12 17:23:49.650 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
|
30
|
+
2019-09-12 17:23:49.835 INFO 4246 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 185 ms
|
31
|
+
長文になってしまい申し訳ありません。
|
32
|
+
|
15
33
|
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
16
34
|
おそらく最初のGetMapping("/players")の時点で処理の問題、もしくはhtmlでのtymeleafのエラーなのかもしれませんが間違いに気づくことができません。
|
17
35
|
JPAによる、自動でテーブルをcreate、レコードのinsert、selectができるかどうかを試しています。
|
3
エラーの出るタイミングの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
になります。
|
14
14
|
|
15
15
|
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
16
|
-
おそらく最初のGetMapping("/players")の時点で
|
16
|
+
おそらく最初のGetMapping("/players")の時点で処理の問題、もしくはhtmlでのtymeleafのエラーなのかもしれませんが間違いに気づくことができません。
|
17
17
|
JPAによる、自動でテーブルをcreate、レコードのinsert、selectができるかどうかを試しています。
|
18
18
|
Tomcatの起動も出来ている、ControllerのURLも間違っていないようですし、原因がわからず滞っています。
|
19
19
|
どうかお力を貸して頂きたいです。
|
2
エラーの出るタイミングの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
現在springとJPAの学習の為、某サイトに載っていたソースコードを参考にさせて頂いてました。
|
4
4
|
しかし、1系と2系(今2系です)の違いなのかどうもブラウザで表示ができません。
|
5
|
+
|
5
6
|
エラー内容としては、
|
6
7
|
Whitelabel Error Page
|
7
8
|
This application has no explicit mapping for /error, so you are seeing this as a fallback.
|
@@ -11,6 +12,8 @@
|
|
11
12
|
No message available
|
12
13
|
になります。
|
13
14
|
|
15
|
+
エラーが出るタイミングとしては起動後、ブラウザにてhttp://localhost:8080/playersと入力した時です。
|
16
|
+
おそらく最初のGetMapping("/players")の時点でエラーが出てしまってるのだとは思っています。もしくはtymeleafのエラーなのかと考えてはいます。
|
14
17
|
JPAによる、自動でテーブルをcreate、レコードのinsert、selectができるかどうかを試しています。
|
15
18
|
Tomcatの起動も出来ている、ControllerのURLも間違っていないようですし、原因がわからず滞っています。
|
16
19
|
どうかお力を貸して頂きたいです。
|
1
a
title
CHANGED
File without changes
|
body
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
@Autowired
|
40
40
|
private PlayerService playerService;
|
41
41
|
|
42
|
-
@GetMapping("/
|
42
|
+
@GetMapping("/players")
|
43
43
|
public String index(Model model) {
|
44
44
|
List<Player> players = playerService.findAll();
|
45
45
|
model.addAttribute("players", players);
|