- 新增 CategoryController、CollectionController、CommentController 等多个控制器类 - 实现了分类、收藏、评论、消息等功能的接口 - 优化了部分方法名称,提高了代码可读性
30 lines
874 B
Java
30 lines
874 B
Java
package com.example.copykamanotes.controller;
|
|
|
|
import com.example.copykamanotes.scope.RequestScopeData;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
@RequestMapping("/api")
|
|
public class TestController {
|
|
|
|
@Autowired
|
|
private RequestScopeData requestScopeData;
|
|
|
|
@GetMapping("/hello")
|
|
public String hello() {
|
|
|
|
System.out.println("get data in /test/hello");
|
|
System.out.println(requestScopeData.getUserId());
|
|
System.out.println(requestScopeData.getToken());
|
|
return "Hello World!";
|
|
}
|
|
|
|
@GetMapping("/exception")
|
|
public String exception() {
|
|
throw new RuntimeException("test exception");
|
|
}
|
|
}
|