无法运行。增加注册逻辑

This commit is contained in:
2025-08-02 10:04:18 +08:00
parent 293820b557
commit 9832336b89
13 changed files with 621 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ public class HelloController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@GetMapping("/")
@GetMapping("/public/hello")
public Result getMethodName() {
return Result.ok().message("Welcome to Yijiantong");
}
@@ -24,7 +24,7 @@ public class HelloController {
*
* @return
*/
@PostMapping("/set")
@PostMapping("/public/set")
public Result setRedis(@RequestParam(value = "username") String username) {
//存储 key-value 键值对: "username"-"jaychou"
stringRedisTemplate.opsForValue().set("username", username);
@@ -36,7 +36,7 @@ public class HelloController {
*
* @return
*/
@GetMapping("/get")
@GetMapping("/public/get")
public Result getRedis(@RequestParam(value = "username") String username) {
//通过 key 值读取 value
String result = stringRedisTemplate.opsForValue().get(username);