【发布时间】:2014-01-23 03:27:38
【问题描述】:
我正在使用 Intellij v13 编写 Spring-Data(使用 AspectJ + Neo4j)。如果我有以下服务文件:
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class BaseClassRepositoryImpl implements BaseClassRepository{
}
public interface BaseClassRepository extends BaseClassRepositoryCustom, GraphRepository<BaseClass> {
}
使用example,上面的代码应该可以工作。但是,Intellij 给了我一个例外:
java: local.ffxiv.repos.BaseClassRepositoryImpl is not abstract and does not override abstract method findByName(java.lang.String) in local.ffxiv.repos.BaseClassRepository
我到处搜索,试图找出 Intellij 这样做的原因。其他人看到了吗?
这也是 build.gradle 脚本:
project.ext {
sourceCompatibility = "1.7"
targetCompatibility = "1.6"
springDataGraphVersion = "2.3.0.RC1"
springVersion = "4.0.0.RELEASE"
junitVersion = "4.11"
neo4jVersion = "2.0.0"
aspectjVersion = "1.7"
}
apply from: 'http://github.com/SpringSource/spring-data-neo4j/raw/master/build/gradle/springdataneo4j.gradle'
configurations {
runtime
testCompile
}
buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.M7")
}
repositories {
maven { url "http://repo.spring.io/milestone" }
mavenCentral()
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'ffxiv_db'
version = '0.1.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-milestone" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://m2.neo4j.org" }
}
dependencies {
// compile list
compile "org.springframework.boot:spring-boot-starter:0.5.0.M7"
compile "org.springframework.data:spring-data-neo4j:$springDataGraphVersion"
compile "org.springframework.data:spring-data-neo4j-aspects:$springDataGraphVersion"
compile "org.neo4j:neo4j:$neo4jVersion"
compile "javax.validation:validation-api:1.0.0.GA"
compile "org.springframework:spring-aspects:$springVersion"
// Test dependencies
testCompile "org.springframework:spring-test:$springVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.neo4j:neo4j-kernel:$neo4jVersion:tests"
}
task wrapper(type: Wrapper) {
gradleVersion = '1.10'
}
这是要求我实现我不需要做的存在(长),但 IntelliJ 一直告诉我。如果我在弹出消息上按 Alt+Enter,我可以点击“实现方法”,它会创建一大堆带有空返回值的覆盖。但是,根据文档,它应该通过函数的名称推断出我想要做什么,并得出该函数对简单 CRUD 操作的作用。 IE。 for 'findByName' 应该返回一个名为“Name”的属性并创建正确的函数。
【问题讨论】:
-
您的
findByName声明在哪里? -
我认为您使用的示例已过时,请查看github.com/spring-projects/spring-data-neo4j/tree/master/…的相应代码
-
@MichaelHunger 你知道使用 aspectj 更新的 build.gradle 在哪里吗? “良好的关系”中提到的那个已经过时了。
标签: java spring intellij-idea neo4j spring-data