我有一个使用 spring-data-rest 的项目,并且有一个只使用 Spring Data 的依赖项目.两个项目都有spring数据仓库,都使用@EnableJpaRepositories
来实现它们的仓库接口,但是我只想导出父项目中的仓库.
I have a project that uses spring-data-rest, and has a dependency project that only uses Spring Data. Both projects have spring data repositories and use @EnableJpaRepositories
to implement their repository interfaces, but I only want to export the repositories in the parent project.
这是我的问题:是否有某种方法可以将 Spring Data REST 配置为仅公开父项目中资源的其余端点,而不必使用 @RepositoryRestResource(exported = false) 显式注释依赖项项目中的每个存储库
?
Here's my question: is there some way to configure Spring Data REST to only expose rest endpoints for resources in the parent project, without having to explicitly annotate every repository in the dependency project with @RepositoryRestResource(exported = false)
?
如果我只能通过禁用它的 @RepositoryRestResource
来做到这一点,更糟糕的是,没有其他具有不同用例的项目能够为这些存储库启用 REST 端点,我的依赖项目将必须包含 Spring Data REST 仅用于……
If I can only do this with @RepositoryRestResource
of disabling it, and worse yet, no other project with a different use case will be able to enable REST endpoints for those repositories, my dependency project will have to include Spring Data REST solely for the…
目前没有全局开关可以满足您的需求.我已经为您提交了这张票,以便包含在下一个主要版本中.
Currently there's no global switch for what you're looking for. I've filed this ticket for you for inclusion in the next major release.
不确定它是否适合您,但包私有存储库接口当前不公开,除非明确注释.如果您可以将所有这些库存储库包保护起来,这可能比显式注释更有利.
Not sure if it is an option for you but package private repository interfaces are not currently exposed unless explicitly annotated. If you can make all those library repositories package protected that might be favorable over the explicit annotation.
这篇关于如何禁用 Spring Data REST 存储库的默认公开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!