第一个springboot项目
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.inmind;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication//表示默认启动项
|
||||
public class SpringbootWebQuickstartApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringbootWebQuickstartApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.inmind.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
//当前类是请求处理类
|
||||
@RestController
|
||||
public class HelloController {
|
||||
|
||||
//接收到请求资源路径为/hello,就由该方法处理请求
|
||||
@RequestMapping("/hello")
|
||||
public String hello(){
|
||||
String s = "hello world";
|
||||
System.out.println(s);
|
||||
return s;
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
# 应用服务 WEB 访问端口
|
||||
server.port=8080
|
||||
|
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>hello word!!!</h1>
|
||||
<p>this is a html page</p>
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,13 @@
|
||||
package com.inmind;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class SpringbootWebQuickstartApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user