【问题标题】:Request not hitting spring boot embeded server through tomcat and browser请求不通过tomcat和浏览器访问spring boot嵌入式服务器
【发布时间】:2022-01-20 20:36:49
【问题描述】:

我试图在 spring boot 中使用通过浏览器和邮递员配置的嵌入式服务器来访问我的 rest API,但是请求没有访问服务器并且我得到 404-not found 我对 springboot 很新,请帮助我至于进一步检查的内容,以便我可以测试我的其余 API

【问题讨论】:

    标签: api rest postman


    【解决方案1】:

    这可能是由于几个原因

    试试下面的

    1. 确保您指定的端口正确
    2. 确保您指定的端点存在
    3. 确保您发送的请求是正确的 REST 操作类型(GET、POST 等)
    4. 确保您的控制器类在应用程序类(with @SpringBootAnnotation) 所在的同一包中可用,否则您必须使用@ComponentScan 来确保扫描您的控制器类并且端点可用于接收流量

    很可能,以上应该会有所帮助:) 如果没有,您需要描述到目前为止在应用程序中所做的工作

    【讨论】:

      猜你喜欢
      • 2019-10-11
      • 1970-01-01
      • 2019-07-31
      • 2013-09-28
      • 2021-05-23
      • 1970-01-01
      • 2018-09-24
      • 2018-08-13
      • 2017-06-01
      相关资源
      最近更新 更多