spring-boot - spring cloud项目前端显示404
问题描述
在做毕业设计的时候,尝试过使用spring cloud搭建框架。在搭建的过程中,由于自学的限制,有些知识点没有完全理解,所以遇到了很多问题。这些问题大部分都是通过网上前辈的分享解决的,但是现在遇到这个问题,在网上搜索了很多相关资料都没有找到解决办法。所以我在寻求帮助。
项目启动后,在rundashboard中点击端口号40999和40888时,谷歌浏览器显示404,如下: enter image description here 但是当我从Eureka页面访问时,它可以工作而且当我使用谷歌或者邮递员,页面仍然显示404和上面的错误信息。
在网上发现了很多相关的问题,包括应用。属性配置和启动类位置。仍然希望有人可以帮助我。谢谢。这是我的测试控制器。
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/test")
@RestController
public class TestController {
@RequestMapping("/hello")
@ResponseBody
public String test(){
return "hello";
}
}
这是 application.properties:
spring.application.name=client
server.port=40999
eureka.client.serviceUrl.defaultZone=http://localhost:20000/eureka/
解决方案
推荐阅读
- c# - 简化条件 if 语句 c#
- math - 正交检查;不正确的数学或函数使用?
- c - 写入文件失败
- json - 当命令包含空格时,如何将参数从 Visual Studio Code task.json 传递给 g++ 命令
- python - Beautiful Soup 的 XML 解析器无法处理布尔属性?
- qliksense - 在 Qlik sense mashup 中切换特定图表中的指标
- javascript - 如何发送诸如表单数据邮递员之类的值-反应js
- vba - 从 dotm 加载宏
- git-merge - 如何解决 gerrit 已批准审核中的合并冲突?
- c# - 转换 Ienumerable
数组并添加到列表 C#