質問編集履歴
3
一部修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Spring Boot エラー: メイン・クラスcom.example.Applicationを検出およびロードできませんでした
|
1
|
+
Spring Boot エラー: メイン・クラスcom.example.demo.DemoApplicationを検出およびロードできませんでした
|
test
CHANGED
File without changes
|
2
一部修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
<properties>
|
18
18
|
|
19
|
-
<start-class>com.example.Application</start-class>
|
19
|
+
<start-class>com.example.demo.DemoApplication</start-class>
|
20
20
|
|
21
21
|
<java.version>11</java.version>
|
22
22
|
|
1
ソースコード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,3 +25,83 @@
|
|
25
25
|
```
|
26
26
|
|
27
27
|
※Applicationは***Application.javaファイルのclass名
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
### ソースコード
|
34
|
+
|
35
|
+
DemoApplication.java
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
package com.example.demo;
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
import org.springframework.boot.SpringApplication;
|
44
|
+
|
45
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
@SpringBootApplication
|
50
|
+
|
51
|
+
public class DemoApplication {
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
public static void main(String[] args) {
|
56
|
+
|
57
|
+
SpringApplication.run(DemoApplication.class, args);
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
DemoController.java
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
package com.example.demo;
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
import org.springframework.stereotype.Controller;
|
78
|
+
|
79
|
+
import org.springframework.web.bind.annotation.RequestMapping;
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
@Controller
|
84
|
+
|
85
|
+
public class DemoController {
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
@RequestMapping(value="/hello")
|
90
|
+
|
91
|
+
private String hello(){
|
92
|
+
|
93
|
+
return "/index.html";
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
index.html
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
Hello World!
|
106
|
+
|
107
|
+
```
|