diff --git a/spring-boot-demo-helloworld/README.md b/spring-boot-demo-helloworld/README.md new file mode 100644 index 0000000..82b268e --- /dev/null +++ b/spring-boot-demo-helloworld/README.md @@ -0,0 +1,113 @@ +# spring-boot-demo-helloworld + +## pom.xml +```xml + + + 4.0.0 + + com.xkcoding + spring-boot-demo-helloworld + 0.0.1-SNAPSHOT + jar + + spring-boot-demo-helloworld + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + cn.hutool + hutool-all + 4.1.14 + + + + + spring-boot-demo-helloworld + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + +``` + +## SpringBootDemoHelloworldApplication.java + +```java +/** + *

+ * 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); + } +} + +``` + +## application.yml + +```yaml +server: + port: 8080 + servlet: + context-path: /demo +``` +