Spring Boot启动后Postman报ECONNREFUSED错误求助
问题解决步骤
- 定位核心问题:你的Spring Boot应用控制台显示
BUILD SUCCESS但实际未启动,根源是JPA仓库的findAllByOrderName()方法引用了ProductCategory实体不存在的orderName属性,导致Spring无法创建对应的Repository Bean,应用启动流程直接中断。 - 修复JPA仓库方法:
- 打开
ProductCategory实体类,确认你要用来排序的实际属性名称(比如是name、sortOrder这类真实存在的字段)。 - 修改JPA仓库接口里的方法名,让它和实体属性名匹配。举个例子:
// 错误写法 List<ProductCategory> findAllByOrderName(); // 正确写法(假设要按name属性升序排序) List<ProductCategory> findAllByOrderByNameAsc();
- 打开
- 验证应用启动状态:改完之后重新启动应用,盯着启动日志看,直到出现类似
Started Application in X seconds的日志,说明应用真的启动成功了。 - 测试接口:这时候再用Postman调用
http://localhost:8080/api/product-categories,就能正常请求了。
内容的提问来源于stack exchange,提问作者Art yudi
相关产品推荐
相关产品推荐

