OPK*_*OPK 32 spring intellij-idea spring-data spring-data-jpa
我已经使用Spring Data JPA设置了一个spring boot项目,但我没有看到Spring数据jpa的智能.

屏幕截图显示问题,我的餐厅实体有一个变量调用restaurantAddress,我试图让intelliJ帮助我完成编码,但没有智能显示.
我的项目设置如下:
申请类:
@SpringBootApplication
@ComponentScan(basePackages = {"com.mycompany"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>food</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<dependencies>
<!-- Dependencies for RESTful Web Services -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Dependencies for JPA Data Persistence -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!--JDBC-->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
<build>
<finalName>food</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
我在IntelliJ 15上安装了Spring Data插件,prject设置:
Ali*_*ani 30
我通过添加JavaEE Persistence框架支持解决了这个问题.只需右键单击项目,选择Add Framework Support然后向下滚动以查找JavaEE Persistence,然后启用复选框并单击确定:
它会添加一个persistence.xml文件,你可以删除它.最后,您的自动完成将返回:
更新您还可以JPA在中启用构面Project Structure.首先,按Ctrl Alt Shift S或转到Files > Project Structure.点击Add按钮,然后在菜单中选择JPA:
终于打了OK.
| 归档时间: |
|
| 查看次数: |
10483 次 |
| 最近记录: |