简体   繁体   English

Spring 启动 MultipartFile 请求返回 404

[英]Spring boot MultipartFile request returns 404

I make post multipart request and get 404我发出多部分请求并得到 404

see that: the path is correct!!看到:路径是正确的!!

here it is my controlller: my controller这是我的控制器:我的 controller

here it is my Bean: Bean registration这是我的 Bean: Bean 注册

Please note that i dont get any error!!请注意,我没有收到任何错误!! Only 404只有 404

What can be the isssue?可能是什么问题? Thank you谢谢

UPDATE I have found the issue I have 2 kind of controllers 1 - Javax (Jakarta) controller with prefix "rest" 2 - Spring Controller (that i tried to create) with same "rest prefix更新我发现了我有 2 种控制器的问题 1 - Javax (Jakarta) controller 带有前缀“rest” 2 - Spring Controller(我试图创建)带有相同的“rest 前缀”

I understood that we cannot have those different controllers with same prefix this causes a conflict I have just renamed the second prefix to "restapi" and both are working: It took me 2 weeks to resolve it :)我知道我们不能让那些不同的控制器具有相同的前缀这会导致冲突我刚刚将第二个前缀重命名为“restapi”并且两者都在工作:我花了 2 周的时间来解决它:)

Changing the annotation of the controller class from @Controller to @RestController solved my issue.将 controller class 的注释从 @Controller 更改为 @RestController 解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM