From 03292ff18a79efb44d45e760dc6e4f811a22d40c Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 17:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BAHello=20world=E4=B9=9F404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 19 +++++++++++------ .../xkrs/controller/HelloWorldController.java | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/xkrs/controller/HelloWorldController.java diff --git a/pom.xml b/pom.xml index 2af2ca0..0287bc5 100644 --- a/pom.xml +++ b/pom.xml @@ -147,11 +147,11 @@ - - org.apache.tomcat - servlet-api - 6.0.35 - + + + + + org.apache.httpcomponents @@ -162,12 +162,19 @@ - org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + + diff --git a/src/main/java/com/xkrs/controller/HelloWorldController.java b/src/main/java/com/xkrs/controller/HelloWorldController.java new file mode 100644 index 0000000..ce0af87 --- /dev/null +++ b/src/main/java/com/xkrs/controller/HelloWorldController.java @@ -0,0 +1,21 @@ +package com.xkrs.controller; + +import com.xkrs.encapsulation.PromptMessageEnum; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +@RestController +public class HelloWorldController { + + @GetMapping("/hello") + public String hello() { + Locale locale = LocaleContextHolder.getLocale(); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "hello", locale); + } + +}