如何在 Spring 引导项目中启用 JPA facet?

How to enable JPA facet in Spring Boot project?

我正在使用 Sprint 工具套件 IDE。

  • Version: 3.8.4.RELEASE
  • Build Id: 201703310825
  • Platform: Eclipse Neon.3(4.6.3)

我正在尝试做一个 spring 引导演示应用程序,用于将数据读取和写入 Postgres 数据库。根据 Spring 引导指南,我能够做到这一点。我的 Spring 引导项目的 pom.xml.

中有以下依赖项
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <scope>runtime</scope>
</dependency>

现在,我想使用 JPA Diagram Editor 对我的实体进行可视化设计并自动生成域实体代码。为此,本教程说要启用 JPA facet。当我尝试在我的项目中执行此操作时,出现错误 "JPA 2.1 requires Java 1.5 or newer"。我的机器上只有 Java 1.8 SDK,所以这应该不是问题。我还进入了运行时选项卡,看看我是否可以在那里添加一些东西,但是那里什么也没有。

那么,如何将 STS 中的 Springboot 项目配置为 JPA 项目,以便启用 JPA 相关方面?

我想通了我错过了什么。在 STS IDE 中,当我尝试启用 JPA 方面时,我只检查了 'Cloud Foundry Standalone Application'。我想 Spring 启动项目会自动启用该方面。除了启用 JPA 方面,我还必须启用 Java 方面。我让 JPA 开始工作,现在我可以使用 JPA 图编辑器了。

感谢大家的建议。