简体   繁体   English

为什么POST请求在Eclipse之外不起作用

[英]Why does POST request not work outside of Eclipse

I am running a springboot application and I ran it two ways: 我正在运行springboot应用程序,并以两种方式运行它:

1) running the spring boot app within eclipse run as -> application and selecting the Application.java for the spring boot app and running it in Eclipse itself. 1)在eclipse run as -> application spring boot app,并为spring boot app选择Application.java并在Eclipse本身中运行。 All the POST requests I am sending to it work perfectly fine. 我发送给它的所有POST请求都可以正常工作。

2) compile the spring boot into a jar and then run it as java -jar <>.jar . 2)将spring boot编译到jar中,然后将其作为java -jar <>.jar The application starts fine but only SOME of the POST requests work this time. 该应用程序启动正常,但是这次只有一些POST请求有效。

Is there a reason why this could be happening? 有什么原因可能会发生这种情况吗? I am not sending the requests differently in either case. 在这两种情况下,我都不会以不同的方式发送请求。 In the second case, I am getting a 500 error 在第二种情况下,我收到500错误

OK I figured out the issue, I have an angular frontend where I am passing in Typescript objects back to the server which Spring then automatically maps to POJOs. 好的,我发现了这个问题,我有一个角度前端,我将Typescript对象传递回服务器,Spring随后会自动将其映射到POJO。 For some reason, this mapping was working when I ran the application in Eclipse as an Eclipse application, but not when I ran the packaged JAR as a standalone server. 由于某种原因,当我在Eclipse中将应用程序作为Eclipse应用程序运行时,此映射有效,但当我将打包的JAR作为独立服务器运行时,此映射不起作用。

This is the reason behind the error, but if anyone can shed light on WHY this difference in mapping exists, it would make this less painful. 这就是错误的原因,但是如果任何人都可以弄清楚为什么映射中存在这种差异,那么这将减轻痛苦。

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

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