From 3162ac39f075e1b5902ad67c2598af0cc759af33 Mon Sep 17 00:00:00 2001
From: "Yangkai.Shen" <237497819@qq.com>
Date: Fri, 28 Sep 2018 15:01:00 +0800
Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-helloworld=20?=
=?UTF-8?q?=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
spring-boot-demo-helloworld/.gitignore | 25 +++++++++
spring-boot-demo-helloworld/pom.xml | 56 +++++++++++++++++++
.../SpringBootDemoHelloworldApplication.java | 44 +++++++++++++++
.../src/main/resources/application.yml | 4 ++
...ingBootDemoHelloworldApplicationTests.java | 16 ++++++
5 files changed, 145 insertions(+)
create mode 100644 spring-boot-demo-helloworld/.gitignore
create mode 100644 spring-boot-demo-helloworld/pom.xml
create mode 100644 spring-boot-demo-helloworld/src/main/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplication.java
create mode 100644 spring-boot-demo-helloworld/src/main/resources/application.yml
create mode 100644 spring-boot-demo-helloworld/src/test/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplicationTests.java
diff --git a/spring-boot-demo-helloworld/.gitignore b/spring-boot-demo-helloworld/.gitignore
new file mode 100644
index 0000000..82eca33
--- /dev/null
+++ b/spring-boot-demo-helloworld/.gitignore
@@ -0,0 +1,25 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/build/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
\ No newline at end of file
diff --git a/spring-boot-demo-helloworld/pom.xml b/spring-boot-demo-helloworld/pom.xml
new file mode 100644
index 0000000..4fb21bd
--- /dev/null
+++ b/spring-boot-demo-helloworld/pom.xml
@@ -0,0 +1,56 @@
+
+
+ * SpringBoot启动类 + *
+ * + * @package: com.xkcoding.helloworld + * @description: SpringBoot启动类 + * @author: yangkai.shen + * @date: Created in 2018/9/28 2:49 PM + * @copyright: Copyright (c) + * @version: V1.0 + * @modified: yangkai.shen + */ +@SpringBootApplication +@RestController +public class SpringBootDemoHelloworldApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoHelloworldApplication.class, args); + } + + /** + * Hello,World + * + * @param who 参数,非必须 + * @return Hello, ${who} + */ + @GetMapping("/hello") + public String sayHello(@RequestParam(required = false, name = "who") String who) { + if (StrUtil.isBlank(who)) { + who = "World"; + } + return StrUtil.format("Hello, {}!", who); + } +} diff --git a/spring-boot-demo-helloworld/src/main/resources/application.yml b/spring-boot-demo-helloworld/src/main/resources/application.yml new file mode 100644 index 0000000..a02fbde --- /dev/null +++ b/spring-boot-demo-helloworld/src/main/resources/application.yml @@ -0,0 +1,4 @@ +server: + port: 8080 + servlet: + context-path: /demo \ No newline at end of file diff --git a/spring-boot-demo-helloworld/src/test/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplicationTests.java b/spring-boot-demo-helloworld/src/test/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplicationTests.java new file mode 100644 index 0000000..d4afb69 --- /dev/null +++ b/spring-boot-demo-helloworld/src/test/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplicationTests.java @@ -0,0 +1,16 @@ +package com.xkcoding.helloworld; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootDemoHelloworldApplicationTests { + + @Test + public void contextLoads() { + } + +}