繁体   English   中英

使用Intellij和Spring-Data-Neo4j / w在尝试创建Repos时,Aspectj会出现Java错误

[英]Using Intellij with Spring-Data-Neo4j /w Aspectj gives Java error when trying to create the Repos

我正在使用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> {

}

使用该示例 ,上面的代码应该可行。 但是,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弹出消息的屏幕截图

这是要求我实现存在(Long),我不应该这样做,但IntelliJ一直告诉我。 如果我执行Alt + Enter,在弹出消息中,我可以点击“实现方法”,它会创建一大堆具有空返回值的覆盖。 但是,根据文档,它应该通过函数名称推断出我想要做什么,并导出函数对简单CRUD操作的作用。 'findByName'的IE应返回名为“Name”的属性,并创建正确的函数。

异常消息非常明确: local.ffxiv.repos.BaseClassRepositoryImpl类应该声明为abstract或者必须实现local.ffxiv.repos.BaseClassRepositoryfindByName(java.lang.String)方法(它扩展了BaseClassRepositoryCustom位置)因为我猜是声明了findByName )。

与您引用的示例进行比较: WorldRepositoryImpl实现MyWorldRepository并覆盖其所有方法。

UPD

可能你的BaseClassRepositoryImpl应该实现BaseClassRepositoryCustom而不是BaseClassRepository 然后,您将只需要覆盖BaseClassRepositoryCustom方法,而不是整个GraphRepository

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM