【发布时间】:2017-08-10 09:50:46
【问题描述】:
我有一个可用的 JpaRepository 作为接口,还有一个可用的 Restcontroller。
目前它们是两种类型,我想将它们合二为一!
这就是我所拥有的:
@Repository
@RestController("problem")
public interface ProblemsController extends JpaRepository<Problem, Integer> {
@RequestMapping(value = "all", method = RequestMethod.GET)
List<Problem> findAll();
}
但是当我打电话给http://localhost:8080/application/problem/all 时,我得到了 404。
怎么办?
【问题讨论】:
-
你试过@RequestMapping(value = "/all", method = RequestMethod.GET)
-
我也认为是一个错字,但你写的是应用程序而不是应用程序
-
@Peter Rader 看看我的解决方案
-
FWIW JPARepository != JPA API。标签固定
-
我投票决定将此问题作为离题结束,因为它是一个 XY 问题并且会促进不良架构。
标签: java spring spring-data-jpa restful-url