新建Hello world也404

This commit is contained in:
liuchengqian 2022-02-28 17:41:14 +08:00
parent ba081cec00
commit 03292ff18a
2 changed files with 34 additions and 6 deletions

19
pom.xml
View File

@ -147,11 +147,11 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/servlet-api --> <!-- https://mvnrepository.com/artifact/org.apache.tomcat/servlet-api -->
<dependency> <!-- <dependency>-->
<groupId>org.apache.tomcat</groupId> <!-- <groupId>org.apache.tomcat</groupId>-->
<artifactId>servlet-api</artifactId> <!-- <artifactId>servlet-api</artifactId>-->
<version>6.0.35</version> <!-- <version>6.0.35</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
@ -162,12 +162,19 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -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);
}
}