You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3.4.1中spring.data.rest.base-path引发404疑与DevTools冲突

Spring Boot 3.4.1升级后Spring Data REST配置失效(与DevTools冲突)问题

环境

  • Spring Boot 3.4.1
  • Java 23

复现步骤

  1. 克隆示例仓库
  2. 进入项目目录
  3. 运行应用:mvn clean spring-boot:run
  4. 访问API:
    • 浏览器访问 http://localhost:8080/api/todos
    • 或执行命令:curl -v http://localhost:8080/api/todos
      执行后会收到404错误。

现象

访问端点时出现Whitelabel错误页面,错误日志如下:

org.springframework.web.servlet.resource.NoResourceFoundException: No static resource api/todos

预期行为

返回200状态码及如下JSON响应:

{
  "_embedded": {
    "todos": []
  },
  "_links": {
    "self": {
      "href": "http://localhost:8080/api/todos?page=0&size=20"
    },
    "profile": {
      "href": "http://localhost:8080/api/profile/todos"
    }
  },
  "page": {
    "size": 20,
    "totalElements": 0,
    "totalPages": 0,
    "number": 0
  }
}

DevTools冲突排查

移除spring-boot-devtools依赖后,应用可正常运行,端点返回预期响应。

已尝试操作

  • 降级至Spring Boot 3.4.0、3.3.0等更早3.x版本,spring.data.rest.base-path=/api配置可正常工作
  • 验证application.properties配置符合官方文档要求
  • 查阅Spring Boot 3.4.1发布说明,未找到相关变更记录
  • 确认问题仅在3.4.1版本中与DevTools共存时出现

问题咨询

  1. Spring Boot 3.4.1中spring.data.rest.base-path的行为是否发生变更?
  2. 该版本中Spring Data REST与DevTools是否存在已知冲突?
  3. 此问题属于Bug还是配置已被弃用/修改?
  4. 代码或配置是否存在问题?
  5. 有无其他替代解决方案?

已向Spring Boot团队提交相关Bug反馈。

内容的提问来源于stack exchange,提问作者knelson59406

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 08:37:16