java - GET /me 没有映射
问题描述
我有这个弹簧靴应用程序,我是弹簧靴的新手。我创建了这个控制器,但它抛出 404 并在控制台中显示 No mapping for GET /me。我找不到问题,我需要尽快解决。
这是日志:https ://pastebin.com/Qf5W6MZU
此控制器中的任何其他端点也不起作用。
import org.sefglobal.scholarx.exception.BadRequestException;
import org.sefglobal.scholarx.exception.NoContentException;
import org.sefglobal.scholarx.exception.ResourceNotFoundException;
import org.sefglobal.scholarx.exception.UnauthorizedException;
import org.sefglobal.scholarx.model.Mentee;
import org.sefglobal.scholarx.model.Profile;
import org.sefglobal.scholarx.model.Program;
import org.sefglobal.scholarx.service.IntrospectionService;
import org.sefglobal.scholarx.util.EnrolmentState;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/me")
public class AuthUserController {
private final IntrospectionService introspectionService;
public AuthUserController(IntrospectionService introspectionService) {
this.introspectionService = introspectionService;
}
@GetMapping
@ResponseStatus(HttpStatus.OK)
public Profile getLoggedInUser(@CookieValue(value = "profileId", defaultValue = "-1") long profileId)
throws ResourceNotFoundException, UnauthorizedException {
return introspectionService.getLoggedInUser(profileId);
}
@GetMapping("/programs/mentee")
@ResponseStatus(HttpStatus.OK)
public List<Program> getMenteeingPrograms(@CookieValue(value = "profileId") long profileId)
throws ResourceNotFoundException, NoContentException {
return introspectionService.getMenteeingPrograms(profileId);
}
@PutMapping("/mentor/{id}/confirmation")
@ResponseStatus(HttpStatus.OK)
public Mentee confirmMentor(@PathVariable long id,
@CookieValue(value = "profileId") long profileId)
throws ResourceNotFoundException, BadRequestException {
return introspectionService.confirmMentor(id, profileId);
}
}
解决方案
我发现了我没有包含软件包的问题。
推荐阅读
- gunicorn - 当工人重新启动时,是否可以让 gunicorn 重用 pid?
- c++ - 在 C++ 中设置控制台窗口标题时遇到问题
- reactjs - 我们可以直接从 React 等前端应用程序连接 AWS Secret Manager 吗?
- c - 当我添加 printf 语句时,我的程序的输出发生了变化
- java - 如何打包 java jar 文件以在未安装 JRE 的 Mac 上运行?
- javascript - 在夏令时切换日转换没有一小时的时区
- html - Vue Native NativeBase 标题文本宽度问题
- powerbi - PowerBI web:禁用“加密连接”?
- swiftui - SwiftUI NavigationView 背景颜色
- python-3.x - 如何将字符串转换为 Python 中的字符列表?