如何在IntelliJ中建立数据库连接时生成Spring REST服务?

问题描述 投票:0回答:2

我的MongoDB有很多集合,并希望公开一个CRUD API来访问它们,但我不想花时间为每个集合编写样板代码。我使用IntelliJ作为我的官方IDE和Spring Boot(使用Spring Data)作为我的框架。

是否有工具/插件将我的数据库连接作为输入,获取所有集合并生成Pojos,bean,存储库和服务类?

spring intellij-idea
2个回答
1
投票

您可以使用Telosys tools以便在一分钟内获得所有实体和回购。然后,我建议Spring Data Rest公开你的所有收藏品。

Telosys的mongo模板示例:mongodb-templates


0
投票

我不知道只需单击一下即可生成Spring Data Repos的插件或其他工具,并且这样做非常好。

我建议使用File TemplatesIntellij Live Templates

文件模板支持predefined and custom variables,它们基于apache velocity,因此您可以使用Velocity Template Language (VTL)

此外,当live templates variables处于活动状态时,您可以在文件模板中使用Enable Live Templates

您应该能够使用文件和实时模板在几秒钟内创建Spring Data Repo。

© www.soinside.com 2019 - 2024. All rights reserved.