最佳答案
在 这个 Spring Boot 应用程序中有一个 Web 服务,它为登录用户返回一些数据:
@RequestMapping("/resource")
public Map<String, Object> home() {
Map<String, Object> model = new HashMap<String, Object>();
model.put("id", UUID.randomUUID().toString());
model.put("content", "Hello World");
return model;
}
想象一下,方法的返回值取决于当前登录的用户。
我怎样才能知道,哪个用户登录了该方法?